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 |
---|---|---|---|---|---|
20025882-78 | append string 'str' at the beginning of each value in column 'col' of dataframe `df` | df['col'] = 'str' + df['col'].astype(str) | [
"pandas.reference.api.pandas.dataframe.astype"
] | VAR_STR['VAR_STR'] = 'VAR_STR' + VAR_STR['VAR_STR'].astype(VAR_STR) | conala |
11924135-42 | BeautifulSoup find a tag whose id ends with string 'para' | soup.findAll(id=re.compile('para$')) | [
"python.library.re#re.compile",
"python.library.re#re.findall"
] | soup.findAll(id=re.compile('para$')) | conala |
11924135-85 | select `div` tags whose `id`s begin with `value_xxx_c_1_f_8_a_` | soup.select('div[id^="value_xxx_c_1_f_8_a_"]') | [
"python.library.select#select.select"
] | soup.select('div[id^="value_xxx_c_1_f_8_a_"]') | conala |
4338032-43 | match string 'this is my string' with regex '\\b(this|string)\\b'
then replace it with regex '<markup>\\1</markup>' | re.sub('\\b(this|string)\\b', '<markup>\\1</markup>', 'this is my string') | [
"python.library.re#re.sub"
] | re.sub('VAR_STR', 'VAR_STR', 'VAR_STR') | conala |
3160752-54 | replace backslashes in string `result` with empty string '' | result = result.replace('\\', '') | [
"python.library.stdtypes#str.replace"
] | VAR_STR = VAR_STR.replace('\\', 'VAR_STR') | conala |
3160752-60 | remove backslashes from string `result` | result.replace('\\', '') | [
"python.library.stdtypes#str.replace"
] | VAR_STR.replace('\\', '') | conala |
27457970-81 | separate each character in string `s` by '-' | re.sub('(.)(?=.)', '\\1-', s) | [
"python.library.re#re.sub"
] | re.sub('(.)(?=.)', '\\1-', VAR_STR) | conala |
27457970-4 | concatenate '-' in between characters of string `str` | re.sub('(?<=.)(?=.)', '-', str) | [
"python.library.re#re.sub"
] | re.sub('(?<=.)(?=.)', 'VAR_STR', VAR_STR) | conala |
11144513-58 | cartesian product of `x` and `y` array points into single array of 2d points | numpy.dstack(numpy.meshgrid(x, y)).reshape(-1, 2) | [
"numpy.reference.generated.numpy.meshgrid",
"numpy.reference.generated.numpy.dstack",
"numpy.reference.generated.numpy.reshape"
] | numpy.dstack(numpy.meshgrid(VAR_STR, VAR_STR)).reshape(-1, 2) | conala |
436599-41 | truncate string `s` up to character ':' | s.split(':', 1)[1] | [
"python.library.stdtypes#str.split"
] | VAR_STR.split('VAR_STR', 1)[1] | conala |
9754729-26 | remove index 2 element from a list `my_list` | my_list.pop(2) | [
"python.library.stdtypes#frozenset.pop"
] | VAR_STR.pop(2) | conala |
18272066-92 | Encode each value to 'UTF8' in the list `EmployeeList` | [x.encode('UTF8') for x in EmployeeList] | [
"python.library.stdtypes#str.encode"
] | [x.encode('VAR_STR') for x in VAR_STR] | conala |
12218112-25 | get the sum of each second value from a list of tuple `structure` | sum(x[1] for x in structure) | [
"python.library.functions#sum"
] | sum(x[1] for x in VAR_STR) | conala |
40851413-100 | send data 'HTTP/1.0 200 OK\r\n\r\n' to socket `connection` | connection.send('HTTP/1.0 200 established\r\n\r\n') | [
"python.library.multiprocessing#multiprocessing.connection.Connection.send"
] | VAR_STR.send('HTTP/1.0 200 established\r\n\r\n') | conala |
40851413-34 | send data 'HTTP/1.0 200 OK\r\n\r\n' to socket `connection` | connection.send('HTTP/1.0 200 OK\r\n\r\n') | [
"python.library.multiprocessing#multiprocessing.connection.Connection.send"
] | VAR_STR.send('VAR_STR') | conala |
13324554-1 | create a slice object using string `string_slice` | slice(*[(int(i.strip()) if i else None) for i in string_slice.split(':')]) | [
"python.library.functions#slice",
"python.library.functions#int",
"python.library.stdtypes#str.strip",
"python.library.stdtypes#str.split"
] | slice(*[(int(i.strip()) if i else None) for i in VAR_STR.split(':')]) | conala |
20400135-83 | append a pandas series `b` to the series `a` and get a continuous index | a.append(b).reset_index(drop=True) | [
"pandas.reference.api.pandas.series.reset_index",
"numpy.reference.generated.numpy.append"
] | VAR_STR.append(VAR_STR).reset_index(drop=True) | conala |
20400135-52 | simple way to append a pandas series `a` and `b` with same index | pd.concat([a, b], ignore_index=True) | [
"pandas.reference.api.pandas.concat"
] | pd.concat([VAR_STR, VAR_STR], ignore_index=True) | conala |
7286879-67 | split unicode string "раз два три" into words | '\u0440\u0430\u0437 \u0434\u0432\u0430 \u0442\u0440\u0438'.split() | [
"python.library.stdtypes#str.split"
] | """раз два три""".split() | conala |
14793098-82 | change flask security register url to `/create_account` | app.config['SECURITY_REGISTER_URL'] = '/create_account' | [] | app.config['SECURITY_REGISTER_URL'] = 'VAR_STR' | conala |
200738-3 | encode string `data` as `hex` | data.encode('hex') | [
"python.library.stdtypes#str.encode"
] | VAR_STR.encode('VAR_STR') | conala |
21414159-59 | open the login site 'http://somesite.com/adminpanel/index.php' in the browser | webbrowser.open('http://somesite.com/adminpanel/index.php') | [
"python.library.webbrowser#webbrowser.open"
] | webbrowser.open('VAR_STR') | conala |
5507948-0 | insert row into mysql database with column 'column1' set to the value `value` | cursor.execute('INSERT INTO table (`column1`) VALUES (%s)', (value,)) | [
"python.library.sqlite3#sqlite3.Cursor.execute"
] | cursor.execute('INSERT INTO table (`column1`) VALUES (%s)', (VAR_STR,)) | conala |
740287-34 | check if any item from list `b` is in list `a` | print(any(x in a for x in b)) | [
"python.library.functions#any"
] | print(any(x in VAR_STR for x in VAR_STR)) | conala |
3809265-55 | scalar multiply matrix `a` by `b` | (a.T * b).T | [] | (VAR_STR.T * VAR_STR).T | conala |
1885181-93 | un-escape a backslash-escaped string in `Hello,\\nworld!` | print('"Hello,\\nworld!"'.decode('string_escape')) | [
"python.library.stdtypes#bytearray.decode"
] | print('"Hello,\\nworld!"'.decode('string_escape')) | conala |
3348825-1 | round 1123.456789 to be an integer | print(round(1123.456789, -1)) | [
"python.library.functions#round"
] | print(round(1123.456789, -1)) | conala |
36957908-74 | substitute two or more whitespace characters with character '|' in string `line` | re.sub('\\s{2,}', '|', line.strip()) | [
"python.library.re#re.sub",
"python.library.stdtypes#str.strip"
] | re.sub('\\s{2,}', 'VAR_STR', VAR_STR.strip()) | conala |
1222677-77 | create a list containing elements from list `list` that are predicate to function `f` | [f(x) for x in list] | [] | [VAR_STR(x) for x in VAR_STR] | conala |
21519203-57 | Make a scatter plot using unpacked values of list `li` | plt.scatter(*zip(*li)) | [
"python.library.functions#zip",
"pandas.reference.api.pandas.dataframe.plot.scatter"
] | plt.scatter(*zip(*VAR_STR)) | conala |
16128833-30 | inherit from class `Executive` | super(Executive, self).__init__(*args) | [
"python.library.functions#super",
"python.library.logging#logging.Handler.__init__"
] | super(VAR_STR, self).__init__(*args) | conala |
17856928-74 | terminate process `p` | p.terminate() | [
"python.library.multiprocessing#multiprocessing.Process.terminate"
] | VAR_STR.terminate() | conala |
31743603-4 | make a list of integers from 0 to `5` where each second element is a duplicate of the previous element | print([u for v in [[i, i] for i in range(5)] for u in v]) | [
"python.library.functions#range"
] | print([u for v in [[i, i] for i in range(5)] for u in v]) | conala |
31743603-29 | create a list of integers with duplicate values `[0, 0, 1, 1, 2, 2, 3, 3, 4, 4]` | [0, 0, 1, 1, 2, 2, 3, 3, 4, 4] | [] | [VAR_STR] | conala |
31743603-80 | create a list of integers from 1 to 5 with each value duplicated | [(i // 2) for i in range(10)] | [
"python.library.functions#range"
] | [(i // 2) for i in range(10)] | conala |
14694482-12 | convert a beautiful soup html `soup` to text | print(soup.get_text()) | [
"matplotlib.table_api#matplotlib.table.Cell.get_text"
] | print(VAR_STR.get_text()) | conala |
40311987-33 | calculate the mean of columns with same name in dataframe `df` | df.groupby(by=df.columns, axis=1).mean() | [
"pandas.reference.api.pandas.dataframe.groupby",
"pandas.reference.api.pandas.dataframe.mean"
] | VAR_STR.groupby(by=VAR_STR.columns, axis=1).mean() | conala |
1780174-1 | create a list where each element is a dictionary with keys 'key1' and 'key2' and values corresponding to each value in the lists referenced by keys 'key1' and 'key2' in dictionary `d` | [{'key1': a, 'key2': b} for a, b in zip(d['key1'], d['key2'])] | [
"python.library.functions#zip"
] | [{'VAR_STR': a, 'VAR_STR': b} for a, b in zip(VAR_STR['VAR_STR'], VAR_STR['VAR_STR'])] | conala |
1780174-26 | Split dictionary of lists into list of dictionaries | map(dict, zip(*[[(k, v) for v in value] for k, value in list(d.items())])) | [
"python.library.functions#zip",
"python.library.functions#map",
"python.library.functions#list",
"python.library.stdtypes#dict.items"
] | map(dict, zip(*[[(k, v) for v in value] for k, value in list(d.items())])) | conala |
988228-81 | build a dict of key:value pairs from a string representation of a dict, `{'muffin' : 'lolz', 'foo' : 'kitty'}` | ast.literal_eval("{'muffin' : 'lolz', 'foo' : 'kitty'}") | [
"python.library.ast#ast.literal_eval"
] | ast.literal_eval('VAR_STR') | conala |
7271385-77 | combine two lists `[1, 2, 3, 4]` and `['a', 'b', 'c', 'd']` into a dictionary | dict(zip([1, 2, 3, 4], ['a', 'b', 'c', 'd'])) | [
"python.library.functions#zip",
"python.library.stdtypes#dict"
] | dict(zip([VAR_STR], [VAR_STR])) | conala |
7271385-51 | combine two lists `[1, 2, 3, 4]` and `['a', 'b', 'c', 'd']` into a dictionary | dict(zip([1, 2, 3, 4], ['a', 'b', 'c', 'd'])) | [
"python.library.functions#zip",
"python.library.stdtypes#dict"
] | dict(zip([VAR_STR], [VAR_STR])) | conala |
12604909-49 | pandas: change all the values of a column 'Date' into "int(str(x)[-4:])" | df['Date'] = df['Date'].apply(lambda x: int(str(x)[-4:])) | [
"python.library.functions#int",
"python.library.stdtypes#str"
] | df['VAR_STR'] = df['VAR_STR'].apply(lambda x: int(str(x)[-4:])) | conala |
13490292-70 | format number 1000000000.0 using latex notation | print('\\num{{{0:.2g}}}'.format(1000000000.0)) | [
"python.library.functions#format"
] | print('\\num{{{0:.2g}}}'.format(1000000000.0)) | conala |
8344905-24 | randomly switch letters' cases in string `s` | """""".join(x.upper() if random.randint(0, 1) else x for x in s) | [
"python.library.random#random.randint",
"python.library.stdtypes#str.upper",
"python.library.stdtypes#str.join"
] | """""".join(x.upper() if random.randint(0, 1) else x for x in VAR_STR) | conala |
12843099-82 | convert the argument `date` with string formatting in logging | logging.info('date=%s', date) | [
"python.library.logging#logging.info"
] | logging.info('date=%s', VAR_STR) | conala |
12843099-18 | Log message of level 'info' with value of `date` in the message | logging.info('date={}'.format(date)) | [
"python.library.logging#logging.info",
"python.library.functions#format"
] | logging.VAR_STR('date={}'.format(VAR_STR)) | conala |
30328646-93 | Do group by on `cluster` column in `df` and get its mean | df.groupby(['cluster']).mean() | [
"pandas.reference.api.pandas.dataframe.groupby",
"pandas.reference.api.pandas.dataframe.mean"
] | VAR_STR.groupby(['VAR_STR']).mean() | conala |
1082413-12 | sort list `strings` in alphabetical order based on the letter after percent character `%` in each element | strings.sort(key=lambda str: re.sub('.*%(.).*', '\\1', str)) | [
"python.library.re#re.sub",
"python.library.stdtypes#list.sort"
] | VAR_STR.sort(key=lambda str: re.sub('.*%(.).*', '\\1', str)) | conala |
1082413-43 | sort a list of strings `strings` based on regex match | strings.sort(key=lambda str: re.sub('.*%', '', str)) | [
"python.library.re#re.sub",
"python.library.stdtypes#list.sort"
] | VAR_STR.sort(key=lambda str: re.sub('.*%', '', str)) | conala |
9206964-68 | split string "This is a string" into words that do not contain whitespaces | """This is a string""".split() | [
"python.library.stdtypes#str.split"
] | """VAR_STR""".split() | conala |
9206964-10 | split string "This is a string" into words that does not contain whitespaces | """This is a string""".split() | [
"python.library.stdtypes#str.split"
] | """VAR_STR""".split() | conala |
40076861-4 | merge a pandas data frame `distancesDF` and column `dates` in pandas data frame `datesDF` into single | pd.concat([distancesDF, datesDF.dates], axis=1) | [
"pandas.reference.api.pandas.concat"
] | pd.concat([VAR_STR, VAR_STR.VAR_STR], axis=1) | conala |
12309976-25 | convert a list `my_list` into string with values separated by spaces | """ """.join(my_list) | [
"python.library.stdtypes#str.join"
] | """ """.join(VAR_STR) | conala |
14169122-51 | generate a list of all unique pairs of integers in `range(9)` | list(permutations(list(range(9)), 2)) | [
"python.library.functions#list",
"python.library.functions#range"
] | list(permutations(list(range(9)), 2)) | conala |
5801945-50 | Split a string `text` with comma, question mark or exclamation by non-consuming regex using look-behind | re.split('(?<=[\\.\\?!]) ', text) | [
"python.library.re#re.split"
] | re.split('(?<=[\\.\\?!]) ', VAR_STR) | conala |
26081300-96 | Subtract the mean of each row in dataframe `df` from the corresponding row's elements | df.sub(df.mean(axis=1), axis=0) | [
"pandas.reference.api.pandas.dataframe.sub",
"pandas.reference.api.pandas.dataframe.mean"
] | VAR_STR.sub(VAR_STR.mean(axis=1), axis=0) | conala |
3548673-96 | replace extension '.txt' in basename '/home/user/somefile.txt' with extension '.jpg' | print(os.path.splitext('/home/user/somefile.txt')[0] + '.jpg') | [
"python.library.os.path#os.path.splitext"
] | print(os.path.splitext('VAR_STR')[0] + 'VAR_STR') | conala |
27589325-84 | find and replace 2nd occurrence of word 'cat' by 'Bull' in a sentence 's' | re.sub('^((?:(?!cat).)*cat(?:(?!cat).)*)cat', '\\1Bull', s) | [
"python.library.re#re.sub"
] | re.sub('^((?:(?!cat).)*cat(?:(?!cat).)*)cat', '\\1Bull', VAR_STR) | conala |
27589325-75 | find and replace 2nd occurrence of word 'cat' by 'Bull' in a sentence 's' | re.sub('^((.*?cat.*?){1})cat', '\\1Bull', s) | [
"python.library.re#re.sub"
] | re.sub('^((.*?cat.*?){1})cat', '\\1Bull', VAR_STR) | conala |
379906-43 | parse string `a` to float | float(a) | [
"python.library.functions#float"
] | float(VAR_STR) | conala |
379906-7 | Parse String `s` to Float or Int | try:
return int(s)
except ValueError:
return float(s) | [
"python.library.functions#float",
"python.library.functions#int"
] | try:
return int(VAR_STR)
except ValueError:
return float(VAR_STR) | conala |
180606-7 | convert a list `L` of ascii values to a string | """""".join(chr(i) for i in L) | [
"python.library.functions#chr",
"python.library.stdtypes#str.join"
] | """""".join(chr(i) for i in VAR_STR) | conala |
9758959-69 | sort list `['10', '3', '2']` in ascending order based on the integer value of its elements | sorted(['10', '3', '2'], key=int) | [
"python.library.functions#sorted"
] | sorted([VAR_STR], key=int) | conala |
41894454-52 | custom sort an alphanumeric list `l` | sorted(l, key=lambda x: x.replace('0', 'Z')) | [
"python.library.functions#sorted",
"python.library.stdtypes#str.replace"
] | sorted(VAR_STR, key=lambda x: x.replace('0', 'Z')) | conala |
13656519-84 | strip a string `line` of all carriage returns and newlines | line.strip() | [
"python.library.stdtypes#str.strip"
] | VAR_STR.strip() | conala |
11837979-28 | remove white space padding around a saved image `test.png` in matplotlib | plt.savefig('test.png', bbox_inches='tight') | [
"matplotlib.figure_api#matplotlib.figure.Figure.savefig"
] | plt.savefig('VAR_STR', bbox_inches='tight') | conala |
7372592-56 | execute a jar file 'Blender.jar' using subprocess | subprocess.call(['java', '-jar', 'Blender.jar']) | [
"python.library.subprocess#subprocess.call"
] | subprocess.call(['java', '-jar', 'VAR_STR']) | conala |
23887592-74 | Find next sibling element in Python Selenium? | driver.find_element_by_xpath("//p[@id, 'one']/following-sibling::p") | [] | driver.find_element_by_xpath("//p[@id, 'one']/following-sibling::p") | conala |
867866-86 | convert Unicode codepoint to utf8 hex | chr(int('fd9b', 16)).encode('utf-8') | [
"python.library.functions#chr",
"python.library.functions#int",
"python.library.stdtypes#str.encode"
] | chr(int('fd9b', 16)).encode('utf-8') | conala |
13480031-57 | zip keys with individual values in lists `k` and `v` | [dict(zip(k, x)) for x in v] | [
"python.library.functions#zip",
"python.library.stdtypes#dict"
] | [dict(zip(VAR_STR, x)) for x in VAR_STR] | conala |
32743479-65 | read pandas data frame csv `comma.csv` with extra commas in column specifying string delimiter `'` | df = pd.read_csv('comma.csv', quotechar="'") | [
"pandas.reference.api.pandas.read_csv"
] | df = pd.read_csv('VAR_STR', quotechar='VAR_STR') | conala |
18292500-92 | Log message 'test' on the root logger. | logging.info('test') | [
"python.library.logging#logging.info"
] | logging.info('VAR_STR') | conala |
5201191-46 | sort list of lists `L` by the second item in each list | L.sort(key=operator.itemgetter(1)) | [
"python.library.operator#operator.itemgetter",
"python.library.stdtypes#list.sort"
] | VAR_STR.sort(key=operator.itemgetter(1)) | conala |
35711059-64 | extract dictionary values by key 'Feature3' from data frame `df` | feature3 = [d.get('Feature3') for d in df.dic] | [
"pandas.reference.api.pandas.dataframe.get"
] | feature3 = [d.get('VAR_STR') for d in VAR_STR.dic] | conala |
2668909-73 | find the real user home directory using python | os.path.expanduser('~user') | [
"python.library.os.path#os.path.expanduser"
] | os.path.expanduser('~user') | conala |
6243460-84 | lambda function that adds two operands | lambda x, y: x + y | [] | lambda x, y: x + y | conala |
14661701-41 | drop rows whose index value in list `[1, 3]` in dataframe `df` | df.drop(df.index[[1, 3]], inplace=True) | [
"pandas.reference.api.pandas.dataframe.drop"
] | VAR_STR.drop(VAR_STR.index[[VAR_STR]], inplace=True) | conala |
3308102-72 | extract the 2nd elements from a list of tuples | [x[1] for x in elements] | [] | [x[1] for x in elements] | conala |
5775719-36 | find the first letter of each element in string `input` | output = ''.join(item[0].upper() for item in input.split()) | [
"python.library.stdtypes#str.upper",
"python.library.stdtypes#str.join",
"python.library.re#re.split"
] | output = ''.join(item[0].upper() for item in VAR_STR.split()) | conala |
12527959-62 | replace percent-encoded code in request `f` to their single-character equivalent | f = urllib.request.urlopen(url, urllib.parse.unquote(urllib.parse.urlencode(params))) | [
"python.library.urllib.parse#urllib.parse.unquote",
"python.library.urllib.parse#urllib.parse.urlencode",
"python.library.urllib.request#urllib.request.urlopen"
] | VAR_STR = urllib.request.urlopen(url, urllib.parse.unquote(urllib.parse.
urlencode(params))) | conala |
19205916-14 | call base class's __init__ method from the child class `ChildClass` | super(ChildClass, self).__init__(*args, **kwargs) | [
"python.library.functions#super",
"python.library.logging#logging.Handler.__init__"
] | super(VAR_STR, self).__init__(*args, **kwargs) | conala |
8199398-65 | extract only alphabetic characters from a string `your string` | """ """.join(re.split('[^a-zA-Z]*', 'your string')) | [
"python.library.re#re.split",
"python.library.stdtypes#str.join"
] | """ """.join(re.split('[^a-zA-Z]*', 'VAR_STR')) | conala |
8199398-34 | Extract only characters from a string as a list | re.split('[^a-zA-Z]*', 'your string') | [
"python.library.re#re.split"
] | re.split('[^a-zA-Z]*', 'your string') | conala |
1386811-62 | Convert binary string to list of integers using Python | [int(s[i:i + 3], 2) for i in range(0, len(s), 3)] | [
"python.library.functions#len",
"python.library.functions#range",
"python.library.functions#int"
] | [int(s[i:i + 3], 2) for i in range(0, len(s), 3)] | conala |
34543513-59 | find maximum with lookahead = 4 in a list `arr` | [max(abs(x) for x in arr[i:i + 4]) for i in range(0, len(arr), 4)] | [
"python.library.functions#len",
"python.library.functions#range",
"python.library.functions#abs",
"python.library.functions#max"
] | [max(abs(x) for x in VAR_STR[i:i + 4]) for i in range(0, len(VAR_STR), 4)] | conala |
3151146-41 | replace single quote character in string "didn't" with empty string '' | """didn't""".replace("'", '') | [
"python.library.stdtypes#str.replace"
] | """VAR_STR""".replace("'", 'VAR_STR') | conala |
12829889-23 | Find a max value of the key `count` in a nested dictionary `d` | max(d, key=lambda x: d[x]['count']) | [
"python.library.functions#max"
] | max(VAR_STR, key=lambda x: VAR_STR[x]['VAR_STR']) | conala |
329886-13 | Get a list of tuples with multiple iterators using list comprehension | [(i, j) for i in range(1, 3) for j in range(1, 5)] | [
"python.library.functions#range"
] | [(i, j) for i in range(1, 3) for j in range(1, 5)] | conala |
2497027-35 | read a binary file 'test/test.pdf' | f = open('test/test.pdf', 'rb') | [
"python.library.urllib.request#open"
] | f = open('VAR_STR', 'rb') | conala |
30945784-37 | remove all characters from string `stri` upto character 'I' | re.sub('.*I', 'I', stri) | [
"python.library.re#re.sub"
] | re.sub('.*I', 'VAR_STR', VAR_STR) | conala |
8243188-64 | append string `foo` to list `list` | list.append('foo') | [
"numpy.reference.generated.numpy.append"
] | VAR_STR.append('VAR_STR') | conala |
8243188-74 | insert string `foo` at position `0` of list `list` | list.insert(0, 'foo') | [
"numpy.reference.generated.numpy.insert"
] | VAR_STR.insert(0, 'VAR_STR') | conala |
12579061-75 | get the text of multiple elements found by xpath "//*[@type='submit']/@value" | browser.find_elements_by_xpath("//*[@type='submit']/@value").text | [] | browser.find_elements_by_xpath('VAR_STR').text | conala |
12579061-34 | find all the values in attribute `value` for the tags whose `type` attribute is `submit` in selenium | browser.find_elements_by_xpath("//*[@type='submit']").get_attribute('value') | [
"python.library.test#test.support.get_attribute"
] | browser.find_elements_by_xpath("//*[@type='submit']").get_attribute('VAR_STR') | conala |
3945856-34 | converting string '(1,2,3,4)' to a tuple | ast.literal_eval('(1,2,3,4)') | [
"python.library.ast#ast.literal_eval"
] | ast.literal_eval('VAR_STR') | conala |
17098654-11 | store data frame `df` to file `file_name` using pandas, python | df.to_pickle(file_name) | [
"pandas.reference.api.pandas.dataframe.to_pickle"
] | VAR_STR.to_pickle(VAR_STR) | conala |
25148611-71 | extract all the values of a specific key named 'values' from a list of dictionaries | results = [item['value'] for item in test_data] | [] | results = [item['value'] for item in test_data] | conala |
2721782-74 | convert a date string `s` to a datetime object | datetime.datetime.strptime(s, '%Y-%m-%dT%H:%M:%SZ') | [
"python.library.datetime#datetime.datetime.strptime"
] | datetime.datetime.strptime(VAR_STR, '%Y-%m-%dT%H:%M:%SZ') | conala |
40852575-70 | Get only first element in each of the innermost of the multidimensional list `listD` | [[[x[0]] for x in listD[i]] for i in range(len(listD))] | [
"python.library.functions#len",
"python.library.functions#range"
] | [[[x[0]] for x in VAR_STR[i]] for i in range(len(VAR_STR))] | conala |