question_id
stringlengths 7
12
| nl
stringlengths 4
200
| cmd
stringlengths 2
232
| oracle_man
sequence | canonical_cmd
stringlengths 2
228
| cmd_name
stringclasses 1
value |
---|---|---|---|---|---|
674519-55 | convert a python dictionary 'a' to a list of tuples | [(k, v) for k, v in a.items()] | [
"python.library.stdtypes#dict.items"
] | [(k, v) for k, v in VAR_STR.items()] | conala |
312443-22 | split list `l` into `n` sized lists | [l[i:i + n] for i in range(0, len(l), n)] | [
"python.library.functions#len",
"python.library.functions#range"
] | [VAR_STR[i:i + VAR_STR] for i in range(0, len(VAR_STR), VAR_STR)] | conala |
312443-22 | split a list `l` into evenly sized chunks `n` | [l[i:i + n] for i in range(0, len(l), n)] | [
"python.library.functions#len",
"python.library.functions#range"
] | [VAR_STR[i:i + VAR_STR] for i in range(0, len(VAR_STR), VAR_STR)] | conala |
28161356-78 | Sort Pandas Dataframe by Date | df.sort_values(by='Date') | [
"pandas.reference.api.pandas.dataframe.sort_values"
] | df.sort_values(by='Date') | conala |
10569438-9 | print 'here is your checkmark: ' plus unicode character u'\u2713' | print('here is your checkmark: ' + '\u2713') | [] | print('here is your checkmark: ' + 'VAR_STR') | conala |
10569438-100 | print unicode characters in a string `\u0420\u043e\u0441\u0441\u0438\u044f` | print('\u0420\u043e\u0441\u0441\u0438\u044f') | [] | print('VAR_STR') | conala |
11219949-92 | append 3 lists in one list | [[] for i in range(3)] | [
"python.library.functions#range"
] | [[] for i in range(3)] | conala |
11219949-47 | Initialize a list of empty lists `a` of size 3 | a = [[] for i in range(3)] | [
"python.library.functions#range"
] | VAR_STR = [[] for i in range(3)] | conala |
39532974-100 | remove letters from string `example_line` if the letter exist in list `bad_chars` | """""".join(dropwhile(lambda x: x in bad_chars, example_line[::-1]))[::-1] | [
"python.library.itertools#itertools.dropwhile",
"python.library.stdtypes#str.join"
] | """""".join(dropwhile(lambda x: x in VAR_STR, VAR_STR[::-1]))[::-1] | conala |
7253803-95 | get every thing after last `/` | url.rsplit('/', 1) | [
"python.library.stdtypes#str.rsplit"
] | url.rsplit('VAR_STR', 1) | conala |
7253803-97 | get everything after last slash in a url stored in variable 'url' | url.rsplit('/', 1)[-1] | [
"python.library.stdtypes#str.rsplit"
] | VAR_STR.rsplit('/', 1)[-1] | conala |
4800419-29 | Find the list in a list of lists `alkaline_earth_values` with the max value of the second element. | max(alkaline_earth_values, key=lambda x: x[1]) | [
"python.library.functions#max"
] | max(VAR_STR, key=lambda x: x[1]) | conala |
31267493-65 | remove elements from list `centroids` the indexes of which are in array `index` | [element for i, element in enumerate(centroids) if i not in index] | [
"python.library.functions#enumerate"
] | [element for i, element in enumerate(VAR_STR) if i not in VAR_STR] | conala |
8303993-4 | convert a list of dictionaries `listofdict into a dictionary of dictionaries | dict((d['name'], d) for d in listofdict) | [
"python.library.stdtypes#dict"
] | dict((d['name'], d) for d in listofdict) | conala |
36518800-16 | sort a list `unsorted_list` based on another sorted list `presorted_list` | sorted(unsorted_list, key=presorted_list.index) | [
"python.library.functions#sorted"
] | sorted(VAR_STR, key=VAR_STR.index) | conala |
18872717-86 | For each index `x` from 0 to 3, append the element at index `x` of list `b` to the list at index `x` of list a. | [a[x].append(b[x]) for x in range(3)] | [
"python.library.functions#range",
"numpy.reference.generated.numpy.append"
] | [a[VAR_STR].append(VAR_STR[VAR_STR]) for VAR_STR in range(3)] | conala |
11351874-64 | convert dictionary `dict` into a flat list | print([y for x in list(dict.items()) for y in x]) | [
"python.library.stdtypes#dict.items",
"python.library.functions#list"
] | print([y for x in list(VAR_STR.items()) for y in x]) | conala |
11351874-3 | Convert a dictionary `dict` into a list with key and values as list items. | [y for x in list(dict.items()) for y in x] | [
"python.library.stdtypes#dict.items",
"python.library.functions#list"
] | [y for x in list(VAR_STR.items()) for y in x] | conala |
234512-44 | split a string 's' by space while ignoring spaces within square braces and quotes. | re.findall('\\[[^\\]]*\\]|"[^"]*"|\\S+', s) | [
"python.library.re#re.findall"
] | re.findall('\\[[^\\]]*\\]|"[^"]*"|\\S+', VAR_STR) | conala |
613183-7 | Sort dictionary `x` by value in ascending order | sorted(list(x.items()), key=operator.itemgetter(1)) | [
"python.library.operator#operator.itemgetter",
"python.library.functions#sorted",
"python.library.functions#list",
"python.library.stdtypes#dict.items"
] | sorted(list(VAR_STR.items()), key=operator.itemgetter(1)) | conala |
613183-35 | Sort dictionary `dict1` by value in ascending order | sorted(dict1, key=dict1.get) | [
"python.library.functions#sorted"
] | sorted(VAR_STR, key=VAR_STR.get) | conala |
613183-93 | Sort dictionary `d` by value in descending order | sorted(d, key=d.get, reverse=True) | [
"python.library.functions#sorted"
] | sorted(VAR_STR, key=VAR_STR.get, reverse=True) | conala |
613183-66 | Sort dictionary `d` by value in ascending order | sorted(list(d.items()), key=(lambda x: x[1])) | [
"python.library.functions#sorted",
"python.library.functions#list",
"python.library.stdtypes#dict.items"
] | sorted(list(VAR_STR.items()), key=lambda x: x[1]) | conala |
1712227-5 | get the size of list `items` | len(items) | [
"python.library.functions#len"
] | len(VAR_STR) | conala |
1712227-52 | get the size of a list `[1,2,3]` | len([1, 2, 3]) | [
"python.library.functions#len"
] | len([1, 2, 3]) | conala |
1712227-61 | get the size of object `items` | items.__len__() | [
"numpy.reference.generated.numpy.ndarray.__len__"
] | VAR_STR.__len__() | conala |
1712227-3 | function to get the size of object | len() | [
"python.library.functions#len"
] | len() | conala |
1712227-90 | get the size of list `s` | len(s) | [
"python.library.functions#len"
] | len(VAR_STR) | conala |
28416408-96 | Fit Kmeans function to a one-dimensional array `x` by reshaping it to be a multidimensional array of single values | km.fit(x.reshape(-1, 1)) | [
"numpy.reference.generated.numpy.reshape",
"pygame.ref.rect#pygame.Rect.fit"
] | km.fit(VAR_STR.reshape(-1, 1)) | conala |
19433630-36 | django create a foreign key column `user` and link it to table 'User' | user = models.ForeignKey('User', unique=True) | [] | VAR_STR = models.ForeignKey('VAR_STR', unique=True) | conala |
6916542-23 | write a list of strings `row` to csv object `csvwriter` | csvwriter.writerow(row) | [
"python.library.csv#csv.csvwriter.writerow"
] | VAR_STR.writerow(VAR_STR) | conala |
21986194-29 | pass dictionary items `data` as keyword arguments in function `my_function` | my_function(**data) | [] | VAR_STR(**VAR_STR) | conala |
39646401-79 | merge the elements in a list `lst` sequentially | [''.join(seq) for seq in zip(lst, lst[1:])] | [
"python.library.functions#zip",
"python.library.stdtypes#str.join"
] | [''.join(seq) for seq in zip(VAR_STR, VAR_STR[1:])] | conala |
6146778-62 | make matplotlib plot legend put marker in legend only once | legend(numpoints=1) | [
"matplotlib.legend_api#matplotlib.legend.Legend"
] | legend(numpoints=1) | conala |
8305518-73 | switch keys and values in a dictionary `my_dict` | dict((v, k) for k, v in my_dict.items()) | [
"python.library.stdtypes#dict",
"python.library.stdtypes#dict.items"
] | dict((v, k) for k, v in VAR_STR.items()) | conala |
5900683-7 | regular expression for validating string 'user' containing a sequence of characters ending with '-' followed by any number of digits. | re.compile('{}-\\d*'.format(user)) | [
"python.library.re#re.compile",
"python.library.functions#format"
] | re.compile('{}-\\d*'.format(VAR_STR)) | conala |
21360028-37 | Get a list comprehension in list of lists `X` | [[X[i][j] for j in range(len(X[i]))] for i in range(len(X))] | [
"python.library.functions#len",
"python.library.functions#range"
] | [[VAR_STR[i][j] for j in range(len(VAR_STR[i]))] for i in range(len(VAR_STR))] | conala |
748491-31 | convert `ms` milliseconds to a datetime object | datetime.datetime.fromtimestamp(ms / 1000.0) | [
"python.library.datetime#datetime.datetime.fromtimestamp"
] | datetime.datetime.fromtimestamp(VAR_STR / 1000.0) | conala |
19555472-57 | change a string of integers `x` separated by spaces to a list of int | x = map(int, x.split()) | [
"python.library.functions#map",
"python.library.stdtypes#str.split"
] | VAR_STR = map(int, VAR_STR.split()) | conala |
19555472-58 | convert a string of integers `x` separated by spaces to a list of integers | x = [int(i) for i in x.split()] | [
"python.library.functions#int",
"python.library.stdtypes#str.split"
] | VAR_STR = [int(i) for i in VAR_STR.split()] | conala |
9554544-22 | subprocess run command 'start command -flags arguments' through the shell | subprocess.call('start command -flags arguments', shell=True) | [
"python.library.subprocess#subprocess.call"
] | subprocess.call('VAR_STR', shell=True) | conala |
9554544-33 | run command 'command -flags arguments &' on command line tools as separate processes | subprocess.call('command -flags arguments &', shell=True) | [
"python.library.subprocess#subprocess.call"
] | subprocess.call('VAR_STR', shell=True) | conala |
16114244-20 | Selenium get the entire `driver` page text | driver.page_source | [] | VAR_STR.page_source | conala |
41807864-53 | regex matching 5-digit substrings not enclosed with digits in `s` | re.findall('(?<!\\d)\\d{5}(?!\\d)', s) | [
"python.library.re#re.findall"
] | re.findall('(?<!\\d)\\d{5}(?!\\d)', VAR_STR) | conala |
5306079-82 | convert a list of strings `['1', '-1', '1']` to a list of numbers | map(int, ['1', '-1', '1']) | [
"python.library.functions#map"
] | map(int, [VAR_STR]) | conala |
13655392-1 | concatenate items from list `parts` into a string starting from the second element | """""".join(parts[1:]) | [
"python.library.stdtypes#str.join"
] | """""".join(VAR_STR[1:]) | conala |
13655392-37 | insert a character ',' into a string in front of '+' character in second part of the string | """,+""".join(c.rsplit('+', 1)) | [
"python.library.stdtypes#str.rsplit",
"python.library.stdtypes#str.join"
] | """,+""".join(c.rsplit('VAR_STR', 1)) | conala |
39159475-83 | Use multiple groupby and agg operations `sum`, `count`, `std` for pandas data frame `df` | df.groupby(level=0).agg(['sum', 'count', 'std']) | [
"pandas.reference.api.pandas.dataframe.groupby",
"pandas.reference.api.pandas.dataframe.agg"
] | VAR_STR.groupby(level=0).agg(['VAR_STR', 'VAR_STR', 'VAR_STR']) | conala |
11361985-41 | output data of the first 7 columns of Pandas dataframe | pandas.set_option('display.max_columns', 7) | [
"pandas.reference.api.pandas.set_option"
] | pandas.set_option('display.max_columns', 7) | conala |
11361985-80 | Display maximum output data of columns in dataframe `pandas` that will fit into the screen | pandas.set_option('display.max_columns', None) | [
"pandas.reference.api.pandas.set_option"
] | VAR_STR.set_option('display.max_columns', None) | conala |
4659524-76 | sort list `the_list` by the length of string followed by alphabetical order | the_list.sort(key=lambda item: (-len(item), item)) | [
"python.library.functions#len",
"python.library.stdtypes#list.sort"
] | VAR_STR.sort(key=lambda item: (-len(item), item)) | conala |
15012228-23 | split a string `s` on last delimiter | s.rsplit(',', 1) | [
"python.library.stdtypes#str.rsplit"
] | VAR_STR.rsplit(',', 1) | conala |
15269161-89 | convert list `a` from being consecutive sequences of tuples into a single sequence of elements | list(itertools.chain(*a)) | [
"python.library.itertools#itertools.chain",
"python.library.functions#list"
] | list(itertools.chain(*VAR_STR)) | conala |
11344827-83 | Sum numbers in a list 'your_list' | sum(your_list) | [
"python.library.functions#sum"
] | sum(VAR_STR) | conala |
15852295-80 | convert a flat list into a list of tuples of every two items in the list, in order | print(zip(my_list[0::2], my_list[1::2])) | [
"python.library.functions#zip"
] | print(zip(my_list[0::2], my_list[1::2])) | conala |
15852295-94 | group a list of ints into a list of tuples of each 2 elements | my_new_list = zip(my_list[0::2], my_list[1::2]) | [
"python.library.functions#zip"
] | my_new_list = zip(my_list[0::2], my_list[1::2]) | conala |
258746-77 | Slice `url` with '&' as delimiter to get "http://www.domainname.com/page?CONTENT_ITEM_ID=1234" from url "http://www.domainname.com/page?CONTENT_ITEM_ID=1234¶m2¶m3
" | url.split('&') | [
"python.library.stdtypes#str.split"
] | VAR_STR.split('VAR_STR') | conala |
14661051-63 | convert python dictionary `your_data` to json array | json.dumps(your_data, ensure_ascii=False) | [
"python.library.json#json.dumps"
] | json.dumps(VAR_STR, ensure_ascii=False) | conala |
36661837-2 | retrieve arabic texts from string `my_string` | print(re.findall('[\\u0600-\\u06FF]+', my_string)) | [
"python.library.re#re.findall"
] | print(re.findall('[\\u0600-\\u06FF]+', VAR_STR)) | conala |
2338531-54 | sort list `L` based on the value of variable 'resultType' for each object in list `L` | sorted(L, key=operator.itemgetter('resultType')) | [
"python.library.operator#operator.itemgetter",
"python.library.functions#sorted"
] | sorted(VAR_STR, key=operator.itemgetter('VAR_STR')) | conala |
2338531-20 | sort a list of objects `s` by a member variable 'resultType' | s.sort(key=operator.attrgetter('resultType')) | [
"python.library.operator#operator.attrgetter",
"python.library.stdtypes#list.sort"
] | VAR_STR.sort(key=operator.attrgetter('VAR_STR')) | conala |
2338531-55 | sort a list of objects 'somelist' where the object has member number variable `resultType` | somelist.sort(key=lambda x: x.resultType) | [
"python.library.stdtypes#list.sort"
] | VAR_STR.sort(key=lambda x: x.VAR_STR) | conala |
1773805-82 | parse a YAML file "example.yaml" | with open('example.yaml', 'r') as stream:
try:
print((yaml.load(stream)))
except yaml.YAMLError as exc:
print(exc) | [
"python.library.urllib.request#open",
"python.library.json#json.load"
] | with open('VAR_STR', 'r') as stream:
try:
print(yaml.load(stream))
except yaml.YAMLError as exc:
print(exc) | conala |
1773805-43 | parse a YAML file "example.yaml" | with open('example.yaml') as stream:
try:
print((yaml.load(stream)))
except yaml.YAMLError as exc:
print(exc) | [
"python.library.urllib.request#open",
"python.library.json#json.load"
] | with open('VAR_STR') as stream:
try:
print(yaml.load(stream))
except yaml.YAMLError as exc:
print(exc) | conala |
21212706-79 | split string `s` into float values and write sum to `total` | total = sum(float(item) for item in s.split(',')) | [
"python.library.functions#float",
"python.library.functions#sum",
"python.library.stdtypes#str.split"
] | VAR_STR = sum(float(item) for item in VAR_STR.split(',')) | conala |
11066400-12 | substitute occurrences of unicode regex pattern u'\\p{P}+' with empty string '' in string `text` | return re.sub('\\p{P}+', '', text) | [
"python.library.re#re.sub"
] | return re.sub('VAR_STR', 'VAR_STR', VAR_STR) | conala |
3283306-10 | get the absolute path of a running python script | os.path.abspath(__file__) | [
"python.library.os.path#os.path.abspath"
] | os.path.abspath(__file__) | conala |
5404665-73 | access value associated with key 'American' of key 'Apple' from dictionary `dict` | dict['Apple']['American'] | [] | VAR_STR['VAR_STR']['VAR_STR'] | conala |
18724607-93 | Python date string formatting | """{0.month}/{0.day}/{0.year}""".format(my_date) | [
"python.library.functions#format"
] | """{0.month}/{0.day}/{0.year}""".format(my_date) | conala |
39187788-53 | find rows with non zero values in a subset of columns where `df.dtypes` is not equal to `object` in pandas dataframe | df.loc[(df.loc[:, (df.dtypes != object)] != 0).any(1)] | [
"pandas.reference.api.pandas.dataframe.loc",
"python.library.functions#any"
] | df.loc[(df.loc[:, (df.dtypes != VAR_STR)] != 0).any(1)] | conala |
34468983-72 | check if all elements in a tuple `(1, 6)` are in another `(1, 2, 3, 4, 5)` | all(i in (1, 2, 3, 4, 5) for i in (1, 6)) | [
"python.library.functions#all"
] | all(i in (VAR_STR) for i in (VAR_STR)) | conala |
11677860-42 | Get a list `C` by subtracting values in one list `B` from corresponding values in another list `A` | C = [(a - b) for a, b in zip(A, B)] | [
"python.library.functions#zip"
] | VAR_STR = [(a - b) for a, b in zip(VAR_STR, VAR_STR)] | conala |
39605640-67 | pull a value with key 'name' from a json object `item` | print(item['name']) | [] | print(VAR_STR['VAR_STR']) | conala |
41083229-90 | removing vowel characters 'aeiouAEIOU' from string `text` | """""".join(c for c in text if c not in 'aeiouAEIOU') | [
"python.library.stdtypes#str.join"
] | """""".join(c for c in VAR_STR if c not in 'VAR_STR') | conala |
28657018-77 | get last element of string splitted by '\\' from list of strings `list_dirs` | [l.split('\\')[-1] for l in list_dirs] | [
"python.library.stdtypes#str.split"
] | [l.split('VAR_STR')[-1] for l in VAR_STR] | conala |
354038-4 | check if string `a` is an integer | a.isdigit() | [
"python.library.stdtypes#str.isdigit"
] | VAR_STR.isdigit() | conala |
354038-84 | function to check if a string is a number | isdigit() | [
"python.library.stdtypes#str.isdigit"
] | isdigit() | conala |
354038-52 | check if string `b` is a number | b.isdigit() | [
"python.library.stdtypes#str.isdigit"
] | VAR_STR.isdigit() | conala |
34015615-56 | reverse a UTF-8 string 'a' | b = a.decode('utf8')[::-1].encode('utf8') | [
"python.library.stdtypes#str.encode",
"python.library.stdtypes#bytearray.decode"
] | b = VAR_STR.decode('utf8')[::-1].encode('utf8') | conala |
20778951-67 | find all occurrences of regex pattern '(?:\\w+(?:\\s+\\w+)*,\\s)+(?:\\w+(?:\\s\\w+)*)' in string `x` | re.findall('(?:\\w+(?:\\s+\\w+)*,\\s)+(?:\\w+(?:\\s\\w+)*)', x) | [
"python.library.re#re.findall"
] | re.findall('VAR_STR', VAR_STR) | conala |
15741759-23 | Return rows of data associated with the maximum value of column 'Value' in dataframe `df` | df.loc[df['Value'].idxmax()] | [
"pandas.reference.api.pandas.dataframe.loc",
"pandas.reference.api.pandas.dataframe.idxmax"
] | VAR_STR.loc[VAR_STR['VAR_STR'].idxmax()] | conala |
2158347-51 | Convert a datetime object `my_datetime` into readable format `%B %d, %Y` | my_datetime.strftime('%B %d, %Y') | [
"python.library.time#time.strftime"
] | VAR_STR.strftime('VAR_STR') | conala |
15795525-71 | Sort items in dictionary `d` using the first part of the key after splitting the key | sorted(list(d.items()), key=lambda name_num: (name_num[0].rsplit(None, 1)[0], name_num[1])) | [
"python.library.functions#sorted",
"python.library.functions#list",
"python.library.stdtypes#str.rsplit",
"python.library.stdtypes#dict.items"
] | sorted(list(VAR_STR.items()), key=lambda name_num: (name_num[0].rsplit(None,
1)[0], name_num[1])) | conala |
33127636-66 | Execute a put request to the url `url` | response = requests.put(url, data=json.dumps(data), headers=headers) | [
"python.library.json#json.dumps",
"numpy.reference.generated.numpy.put"
] | response = requests.put(VAR_STR, data=json.dumps(data), headers=headers) | conala |
17952279-42 | plot a data logarithmically in y axis | plt.yscale('log', nonposy='clip') | [
"matplotlib._as_gen.matplotlib.pyplot.yscale"
] | plt.yscale('log', nonposy='clip') | conala |
6900955-83 | build a dictionary containing the conversion of each list in list `[['two', 2], ['one', 1]]` to a key/value pair as its items | dict([['two', 2], ['one', 1]]) | [
"python.library.stdtypes#dict"
] | dict([VAR_STR]) | conala |
6900955-75 | convert list `l` to dictionary having each two adjacent elements as key/value pair | dict(zip(l[::2], l[1::2])) | [
"python.library.functions#zip",
"python.library.stdtypes#dict"
] | dict(zip(VAR_STR[::2], VAR_STR[1::2])) | conala |
12768504-68 | create list `c` containing items from list `b` whose index is in list `index` | c = [b[i] for i in index] | [] | VAR_STR = [VAR_STR[i] for i in VAR_STR] | conala |
32792874-24 | get geys of dictionary `my_dict` that contain any values from list `lst` | [key for key, value in list(my_dict.items()) if set(value).intersection(lst)] | [
"python.library.functions#list",
"python.library.stdtypes#set",
"python.library.stdtypes#frozenset.intersection",
"python.library.stdtypes#dict.items"
] | [key for key, value in list(VAR_STR.items()) if set(value).intersection(VAR_STR)] | conala |
32792874-83 | get list of keys in dictionary `my_dict` whose values contain values from list `lst` | [key for item in lst for key, value in list(my_dict.items()) if item in value] | [
"python.library.functions#list",
"python.library.stdtypes#dict.items"
] | [key for item in VAR_STR for key, value in list(VAR_STR.items()) if item in value] | conala |
31828240-66 | get first non-null value per each row from dataframe `df` | df.stack().groupby(level=0).first() | [
"pandas.reference.api.pandas.dataframe.stack",
"pandas.reference.api.pandas.dataframe.first",
"pandas.reference.api.pandas.dataframe.groupby"
] | VAR_STR.stack().groupby(level=0).first() | conala |
25292838-12 | Update row values for a column `Season` using vectorized string operation in pandas | df['Season'].str.split('-').str[0].astype(int) | [
"python.library.stdtypes#str.split",
"pandas.reference.api.pandas.series.astype"
] | df['VAR_STR'].str.split('-').str[0].astype(int) | conala |
31465002-50 | find all digits in string '6,7)' and put them to a list | re.findall('\\d|\\d,\\d\\)', '6,7)') | [
"python.library.re#re.findall"
] | re.findall('\\d|\\d,\\d\\)', 'VAR_STR') | conala |
3487377-65 | check if string `foo` is UTF-8 encoded | foo.decode('utf8').encode('utf8') | [
"python.library.stdtypes#str.encode",
"python.library.stdtypes#bytearray.decode"
] | VAR_STR.decode('utf8').encode('utf8') | conala |
7128153-81 | check if dictionary `d` contains all keys in list `['somekey', 'someotherkey', 'somekeyggg']` | all(word in d for word in ['somekey', 'someotherkey', 'somekeyggg']) | [
"python.library.functions#all"
] | all(word in VAR_STR for word in [VAR_STR]) | conala |
18116235-9 | Get only digits from a string `strs` | """""".join([c for c in strs if c.isdigit()]) | [
"python.library.stdtypes#str.isdigit",
"python.library.stdtypes#str.join"
] | """""".join([c for c in VAR_STR if c.isdigit()]) | conala |
40208429-82 | sort dictionary `tag_weight` in reverse order by values cast to integers | sorted(list(tag_weight.items()), key=lambda x: int(x[1]), reverse=True) | [
"python.library.functions#sorted",
"python.library.functions#int",
"python.library.functions#list",
"python.library.stdtypes#dict.items"
] | sorted(list(VAR_STR.items()), key=lambda x: int(x[1]), reverse=True) | conala |
13408919-82 | sort list `mylist` of tuples by arbitrary key from list `order` | sorted(mylist, key=lambda x: order.index(x[1])) | [
"python.library.functions#sorted",
"python.library.stdtypes#str.index"
] | sorted(VAR_STR, key=lambda x: VAR_STR.index(x[1])) | conala |
15334783-78 | multiply values of dictionary `dict` with their respective values in dictionary `dict2` | dict((k, v * dict2[k]) for k, v in list(dict1.items()) if k in dict2) | [
"python.library.stdtypes#dict",
"python.library.functions#list",
"python.library.stdtypes#dict.items"
] | VAR_STR((k, v * VAR_STR[k]) for k, v in list(dict1.items()) if k in VAR_STR) | conala |
14850853-99 | insert directory 'libs' at the 0th index of current directory | sys.path.insert(0, 'libs') | [
"numpy.reference.generated.numpy.insert"
] | sys.path.insert(0, 'VAR_STR') | conala |