question_id
stringlengths 7
12
| nl
stringlengths 4
200
| cmd
stringlengths 2
232
| oracle_man
list | canonical_cmd
stringlengths 2
228
| cmd_name
stringclasses 1
value |
---|---|---|---|---|---|
18684397-80
|
create datetime object from "16sep2012"
|
datetime.datetime.strptime('16Sep2012', '%d%b%Y')
|
[
"python.library.datetime#datetime.datetime.strptime"
] |
datetime.datetime.strptime('16Sep2012', '%d%b%Y')
|
conala
|
6416131-30
|
add key "item3" and value "3" to dictionary `default_data `
|
default_data['item3'] = 3
|
[] |
VAR_STR['VAR_STR'] = 3
|
conala
|
6416131-21
|
add key "item3" and value "3" to dictionary `default_data `
|
default_data.update({'item3': 3, })
|
[
"python.library.stdtypes#dict.update"
] |
VAR_STR.update({'VAR_STR': 3})
|
conala
|
6416131-97
|
add key value pairs 'item4' , 4 and 'item5' , 5 to dictionary `default_data`
|
default_data.update({'item4': 4, 'item5': 5, })
|
[
"python.library.stdtypes#dict.update"
] |
VAR_STR.update({'VAR_STR': 4, 'VAR_STR': 5})
|
conala
|
6696027-18
|
split strings in list `l` on the first occurring tab `\t` and enter only the first resulting substring in a new list
|
[i.split('\t', 1)[0] for i in l]
|
[
"python.library.stdtypes#str.split"
] |
[i.split('VAR_STR', 1)[0] for i in VAR_STR]
|
conala
|
6696027-69
|
Split each string in list `myList` on the tab character
|
myList = [i.split('\t')[0] for i in myList]
|
[
"python.library.stdtypes#str.split"
] |
VAR_STR = [i.split('\t')[0] for i in VAR_STR]
|
conala
|
32792602-55
|
search for occurrences of regex pattern `pattern` in string `url`
|
print(pattern.search(url).group(1))
|
[
"python.library.re#re.Pattern.search",
"pygame.ref.sprite#pygame.sprite.Group"
] |
print(VAR_STR.search(VAR_STR).group(1))
|
conala
|
1614236-63
|
convert all of the items in a list `lst` to float
|
[float(i) for i in lst]
|
[
"python.library.functions#float"
] |
[float(i) for i in VAR_STR]
|
conala
|
2744795-17
|
Change background color in Tkinter
|
root.configure(background='black')
|
[
"python.library.tkinter.ttk#tkinter.ttk.Style.configure"
] |
root.configure(background='black')
|
conala
|
3059301-80
|
encode string `data` using hex 'hex' encoding
|
print(data.encode('hex'))
|
[
"python.library.stdtypes#str.encode"
] |
print(VAR_STR.encode('VAR_STR'))
|
conala
|
3059301-40
|
Return the decimal value for each hex character in data `data`
|
print(' '.join([str(ord(a)) for a in data]))
|
[
"python.library.functions#ord",
"python.library.stdtypes#str",
"python.library.stdtypes#str.join"
] |
print(' '.join([str(ord(a)) for a in VAR_STR]))
|
conala
|
10264618-17
|
encode value of key `City` in dictionary `data` as `ascii`, ignoring non-ascii characters
|
data['City'].encode('ascii', 'ignore')
|
[
"python.library.stdtypes#str.encode"
] |
VAR_STR['VAR_STR'].encode('VAR_STR', 'ignore')
|
conala
|
17467504-57
|
Get all matching patterns 'a.*?a' from a string 'a 1 a 2 a 3 a 4 a'.
|
re.findall('(?=(a.*?a))', 'a 1 a 2 a 3 a 4 a')
|
[
"python.library.re#re.findall"
] |
re.findall('(?=(a.*?a))', 'VAR_STR')
|
conala
|
40156469-42
|
select all rows in dataframe `df` where the values of column 'columnX' is bigger than or equal to `x` and smaller than or equal to `y`
|
df[(x <= df['columnX']) & (df['columnX'] <= y)]
|
[] |
VAR_STR[(VAR_STR <= VAR_STR['VAR_STR']) & (VAR_STR['VAR_STR'] <= VAR_STR)]
|
conala
|
31405409-44
|
remove parentheses only around single words in a string `s` using regex
|
re.sub('\\((\\w+)\\)', '\\1', s)
|
[
"python.library.re#re.sub"
] |
re.sub('\\((\\w+)\\)', '\\1', VAR_STR)
|
conala
|
22296496-67
|
add variable `var` to key 'f' of first element in JSON data `data`
|
data[0]['f'] = var
|
[] |
VAR_STR[0]['VAR_STR'] = VAR_STR
|
conala
|
20504881-46
|
merge pandas dataframe `x` with columns 'a' and 'b' and dataframe `y` with column 'y'
|
pd.merge(y, x, on='k')[['a', 'b', 'y']]
|
[
"pandas.reference.api.pandas.merge"
] |
pd.merge(VAR_STR, VAR_STR, on='k')[['VAR_STR', 'VAR_STR', 'VAR_STR']]
|
conala
|
40512124-86
|
concatenate key/value pairs in dictionary `a` with string ', ' into a single string
|
""", """.join([(str(k) + ' ' + str(v)) for k, v in list(a.items())])
|
[
"python.library.stdtypes#str",
"python.library.functions#list",
"python.library.stdtypes#str.join",
"python.library.stdtypes#dict.items"
] |
""", """.join([(str(k) + ' ' + str(v)) for k, v in list(VAR_STR.items())])
|
conala
|
9507819-61
|
match regex pattern 'a*?bc*?' on string 'aabcc' with DOTALL enabled
|
re.findall('a*?bc*?', 'aabcc', re.DOTALL)
|
[
"python.library.re#re.findall"
] |
re.findall('VAR_STR', 'VAR_STR', re.DOTALL)
|
conala
|
120656-81
|
list all files in directory "."
|
for (dirname, dirnames, filenames) in os.walk('.'):
for subdirname in dirnames:
print(os.path.join(dirname, subdirname))
for filename in filenames:
pass
|
[
"python.library.os.path#os.path.join",
"python.library.os#os.walk"
] |
for dirname, dirnames, filenames in os.walk('VAR_STR'):
for subdirname in dirnames:
print(os.path.join(dirname, subdirname))
for filename in filenames:
pass
|
conala
|
120656-36
|
list all files in directory `path`
|
os.listdir(path)
|
[
"python.library.os#os.listdir"
] |
os.listdir(VAR_STR)
|
conala
|
18711384-26
|
split a `utf-8` encoded string `stru` into a list of characters
|
list(stru.decode('utf-8'))
|
[
"python.library.functions#list",
"python.library.stdtypes#bytearray.decode"
] |
list(VAR_STR.decode('VAR_STR'))
|
conala
|
10716796-78
|
convert a string `s` to its base-10 representation
|
int(s.encode('hex'), 16)
|
[
"python.library.functions#int",
"python.library.stdtypes#str.encode"
] |
int(VAR_STR.encode('hex'), 16)
|
conala
|
7142227-68
|
sort a zipped list `zipped` using lambda function
|
sorted(zipped, key=lambda x: x[1])
|
[
"python.library.functions#sorted"
] |
sorted(VAR_STR, key=lambda x: x[1])
|
conala
|
7142227-50
|
How do I sort a zipped list in Python?
|
zipped.sort(key=lambda t: t[1])
|
[
"python.library.stdtypes#list.sort"
] |
zipped.sort(key=lambda t: t[1])
|
conala
|
4934806-50
|
print script's directory
|
print(os.path.dirname(os.path.realpath(__file__)))
|
[
"python.library.os.path#os.path.dirname",
"python.library.os.path#os.path.realpath"
] |
print(os.path.dirname(os.path.realpath(__file__)))
|
conala
|
29464234-50
|
find all the rows in Dataframe 'df2' that are also present in Dataframe 'df1', for the columns 'A', 'B', 'C' and 'D'.
|
pd.merge(df1, df2, on=['A', 'B', 'C', 'D'], how='inner')
|
[
"pandas.reference.api.pandas.merge"
] |
pd.merge(VAR_STR, VAR_STR, on=['VAR_STR', 'VAR_STR', 'VAR_STR', 'VAR_STR'], how='inner')
|
conala
|
3931541-49
|
check if all of the following items in list `['a', 'b']` are in a list `['a', 'b', 'c']`
|
set(['a', 'b']).issubset(['a', 'b', 'c'])
|
[
"python.library.stdtypes#set",
"python.library.stdtypes#frozenset.issubset"
] |
set([VAR_STR]).issubset([VAR_STR])
|
conala
|
3931541-28
|
Check if all the items in a list `['a', 'b']` exists in another list `l`
|
set(['a', 'b']).issubset(set(l))
|
[
"python.library.stdtypes#set"
] |
set([VAR_STR]).issubset(set(VAR_STR))
|
conala
|
3862010-24
|
split string `string` on whitespaces using a generator
|
return (x.group(0) for x in re.finditer("[A-Za-z']+", string))
|
[
"python.library.re#re.finditer",
"python.library.re#re.Match.group"
] |
return (x.group(0) for x in re.finditer("[A-Za-z']+", VAR_STR))
|
conala
|
7271482-45
|
generate a list containing values associated with the key 'value' of each dictionary inside list `list_of_dicts`
|
[x['value'] for x in list_of_dicts]
|
[] |
[x['VAR_STR'] for x in VAR_STR]
|
conala
|
7271482-32
|
python getting a list of value from list of dict
|
[d['value'] for d in l]
|
[] |
[d['value'] for d in l]
|
conala
|
7271482-21
|
python getting a list of value from list of dict
|
[d['value'] for d in l if 'value' in d]
|
[] |
[d['value'] for d in l if 'value' in d]
|
conala
|
8724352-17
|
BeautifulSoup find all 'tr' elements in HTML string `soup` at the five stride starting from the fourth element
|
rows = soup.findAll('tr')[4::5]
|
[
"python.library.re#re.findall"
] |
rows = VAR_STR.findAll('VAR_STR')[4::5]
|
conala
|
15390374-17
|
get a utf-8 string literal representation of byte string `x`
|
"""x = {}""".format(x.decode('utf8')).encode('utf8')
|
[
"python.library.functions#format",
"python.library.stdtypes#str.encode",
"python.library.stdtypes#bytearray.decode"
] |
"""x = {}""".format(VAR_STR.decode('utf8')).encode('utf8')
|
conala
|
2621674-32
|
extract elements at indices (1, 2, 5) from a list `a`
|
[a[i] for i in (1, 2, 5)]
|
[] |
[VAR_STR[i] for i in (1, 2, 5)]
|
conala
|
12814667-69
|
sort list `a` using the first dimension of the element as the key to list `b`
|
a.sort(key=lambda x: b.index(x[0]))
|
[
"pandas.reference.api.pandas.index.sort"
] |
VAR_STR.sort(key=lambda x: VAR_STR.index(x[0]))
|
conala
|
12814667-58
|
How to sort a list according to another list?
|
a.sort(key=lambda x_y: b.index(x_y[0]))
|
[
"pandas.reference.api.pandas.index.sort"
] |
a.sort(key=lambda x_y: b.index(x_y[0]))
|
conala
|
1207457-34
|
Convert a Unicode string `title` to a 'ascii' string
|
unicodedata.normalize('NFKD', title).encode('ascii', 'ignore')
|
[
"python.library.unicodedata#unicodedata.normalize",
"python.library.stdtypes#str.encode"
] |
unicodedata.normalize('NFKD', VAR_STR).encode('VAR_STR', 'ignore')
|
conala
|
1207457-55
|
Convert a Unicode string `a` to a 'ascii' string
|
a.encode('ascii', 'ignore')
|
[
"python.library.stdtypes#str.encode"
] |
VAR_STR.encode('VAR_STR', 'ignore')
|
conala
|
8282553-31
|
delete all occureces of `8` in each string `s` in list `lst`
|
print([s.replace('8', '') for s in lst])
|
[
"python.library.stdtypes#str.replace"
] |
print([VAR_STR.replace('VAR_STR', '') for VAR_STR in VAR_STR])
|
conala
|
21771133-50
|
replace values of dataframe `df` with True if numeric
|
df.applymap(lambda x: isinstance(x, (int, float)))
|
[
"pandas.reference.api.pandas.dataframe.applymap",
"python.library.functions#isinstance"
] |
VAR_STR.applymap(lambda x: isinstance(x, (int, float)))
|
conala
|
9224385-40
|
convert values in dictionary `d` into integers
|
{k: int(v) for k, v in d.items()}
|
[
"python.library.functions#int",
"python.library.stdtypes#dict.items"
] |
{k: int(v) for k, v in VAR_STR.items()}
|
conala
|
10115967-39
|
generate the combinations of 3 from a set `{1, 2, 3, 4}`
|
print(list(itertools.combinations({1, 2, 3, 4}, 3)))
|
[
"python.library.itertools#itertools.combinations",
"python.library.functions#list"
] |
print(list(itertools.combinations({VAR_STR}, 3)))
|
conala
|
15175142-92
|
double each character in string `text.read()`
|
re.sub('(.)', '\\1\\1', text.read(), 0, re.S)
|
[
"python.library.re#re.sub",
"python.library.os#os.read"
] |
re.sub('(.)', '\\1\\1', text.read(), 0, re.S)
|
conala
|
4697006-77
|
split a string `a , b; cdf` using both commas and semicolons as delimeters
|
re.split('\\s*,\\s*|\\s*;\\s*', 'a , b; cdf')
|
[
"python.library.re#re.split"
] |
re.split('\\s*,\\s*|\\s*;\\s*', 'VAR_STR')
|
conala
|
4697006-83
|
Split a string `string` by multiple separators `,` and `;`
|
[t.strip() for s in string.split(',') for t in s.split(';')]
|
[
"python.library.stdtypes#str.split"
] |
[t.strip() for s in VAR_STR.split('VAR_STR') for t in s.split('VAR_STR')]
|
conala
|
12987178-6
|
sort list `trial_list` based on values of dictionary `trail_dict`
|
sorted(trial_list, key=lambda x: trial_dict[x])
|
[
"python.library.functions#sorted"
] |
sorted(VAR_STR, key=lambda x: trial_dict[x])
|
conala
|
4299741-5
|
merge a list of integers `[1, 2, 3, 4, 5]` into a single integer
|
from functools import reduce
reduce(lambda x, y: 10 * x + y, [1, 2, 3, 4, 5])
|
[] |
from functools import reduce
reduce(lambda x, y: 10 * x + y, [VAR_STR])
|
conala
|
6886493-12
|
Get all object attributes of object `obj`
|
print((obj.__dict__))
|
[] |
print(VAR_STR.__dict__)
|
conala
|
6886493-89
|
Get all object attributes of an object
|
dir()
|
[
"python.library.functions#dir"
] |
dir()
|
conala
|
6886493-2
|
Get all object attributes of an object
|
dir()
|
[
"python.library.functions#dir"
] |
dir()
|
conala
|
10271484-8
|
create a list containing the multiplication of each elements at the same index of list `lista` and list `listb`
|
[(a * b) for a, b in zip(lista, listb)]
|
[
"python.library.functions#zip"
] |
[(a * b) for a, b in zip(VAR_STR, VAR_STR)]
|
conala
|
9153527-61
|
append a path `/path/to/main_folder` in system path
|
sys.path.append('/path/to/main_folder')
|
[
"numpy.reference.generated.numpy.append"
] |
sys.path.append('VAR_STR')
|
conala
|
5858916-91
|
check if any of the items in `search` appear in `string`
|
any(x in string for x in search)
|
[
"python.library.functions#any"
] |
any(x in VAR_STR for x in VAR_STR)
|
conala
|
42747987-29
|
select the first row grouped per level 0 of dataframe `df`
|
df.groupby(level=0, as_index=False).nth(0)
|
[
"pandas.reference.api.pandas.dataframe.groupby",
"pandas.reference.api.pandas.core.groupby.groupby.nth"
] |
VAR_STR.groupby(level=0, as_index=False).nth(0)
|
conala
|
9079540-32
|
Escape character '}' in string '{0}:<15}}{1}:<15}}{2}:<8}}' while using function `format` with arguments `('1', '2', '3')`
|
print('{0}:<15}}{1}:<15}}{2}:<8}}'.format('1', '2', '3'))
|
[
"python.library.functions#format"
] |
print('VAR_STR'.VAR_STR(VAR_STR))
|
conala
|
19618912-23
|
Join data of dataframe `df1` with data in dataframe `df2` based on similar values of column 'user_id' in both dataframes
|
s1 = pd.merge(df1, df2, how='inner', on=['user_id'])
|
[
"pandas.reference.api.pandas.merge"
] |
s1 = pd.merge(VAR_STR, VAR_STR, how='inner', on=['VAR_STR'])
|
conala
|
25279993-12
|
parse string '2015/01/01 12:12am' to DateTime object using format '%Y/%m/%d %I:%M%p'
|
datetime.strptime('2015/01/01 12:12am', '%Y/%m/%d %I:%M%p')
|
[
"python.library.datetime#datetime.datetime.strptime"
] |
datetime.strptime('VAR_STR', 'VAR_STR')
|
conala
|
11391969-89
|
group dataframe `data` entries by year value of the date in column 'date'
|
data.groupby(data['date'].map(lambda x: x.year))
|
[
"python.library.functions#map",
"pandas.reference.groupby"
] |
VAR_STR.groupby(VAR_STR['VAR_STR'].map(lambda x: x.year))
|
conala
|
14159753-79
|
change the size of the sci notation to '30' above the y axis in matplotlib `plt`
|
plt.rc('font', **{'size': '30'})
|
[
"matplotlib._as_gen.matplotlib.pyplot.rc"
] |
VAR_STR.rc('font', **{'size': 'VAR_STR'})
|
conala
|
32032836-96
|
get all column name of dataframe `df` except for column 'T1_V6'
|
df[df.columns - ['T1_V6']]
|
[] |
VAR_STR[VAR_STR.columns - ['VAR_STR']]
|
conala
|
13254241-96
|
removing key values pairs with key 'mykey1' from a list of dictionaries `mylist`
|
[{k: v for k, v in d.items() if k != 'mykey1'} for d in mylist]
|
[
"python.library.stdtypes#dict.items"
] |
[{k: v for k, v in d.items() if k != 'VAR_STR'} for d in VAR_STR]
|
conala
|
13254241-96
|
Removing key values pairs from a list of dictionaries
|
[dict((k, v) for k, v in d.items() if k != 'mykey1') for d in mylist]
|
[
"python.library.stdtypes#dict.items"
] |
[dict((k, v) for k, v in d.items() if k != 'mykey1') for d in mylist]
|
conala
|
18723580-43
|
strip the string `.txt` from anywhere in the string `Boat.txt.txt`
|
"""Boat.txt.txt""".replace('.txt', '')
|
[
"python.library.stdtypes#str.replace"
] |
"""VAR_STR""".replace('VAR_STR', '')
|
conala
|
2168123-74
|
split string "0,1,2" based on delimiter ','
|
"""0,1,2""".split(',')
|
[
"python.library.stdtypes#str.split"
] |
"""VAR_STR""".split('VAR_STR')
|
conala
|
2168123-3
|
convert the string '0,1,2' to a list of integers
|
[int(x) for x in '0,1,2'.split(',')]
|
[
"python.library.functions#int",
"python.library.stdtypes#str.split"
] |
[int(x) for x in 'VAR_STR'.split(',')]
|
conala
|
2108126-46
|
run function 'SudsMove' simultaneously
|
threading.Thread(target=SudsMove).start()
|
[
"python.library.threading#threading.Thread",
"python.library.threading#threading.Thread.start"
] |
threading.Thread(target=VAR_STR).start()
|
conala
|
17972020-38
|
execute raw sql queue '<sql here>' in database `db` in sqlalchemy-flask app
|
result = db.engine.execute('<sql here>')
|
[
"python.library.msilib#msilib.View.Execute"
] |
result = VAR_STR.engine.execute('VAR_STR')
|
conala
|
11791568-17
|
What is the most pythonic way to exclude elements of a list that start with a specific character?
|
[x for x in my_list if not x.startswith('#')]
|
[
"python.library.stdtypes#str.startswith"
] |
[x for x in my_list if not x.startswith('#')]
|
conala
|
12723751-59
|
Replace `;` with `:` in a string `line`
|
line = line.replace(';', ':')
|
[
"python.library.stdtypes#str.replace"
] |
VAR_STR = VAR_STR.replace('VAR_STR', 'VAR_STR')
|
conala
|
40535203-57
|
get a list of last trailing words from another list of strings`Original_List`
|
new_list = [x.split()[-1] for x in Original_List]
|
[
"python.library.stdtypes#str.split"
] |
new_list = [x.split()[-1] for x in VAR_STR]
|
conala
|
12307099-72
|
set the value in column 'B' to NaN if the corresponding value in column 'A' is equal to 0 in pandas dataframe `df`
|
df.ix[df.A == 0, 'B'] = np.nan
|
[] |
VAR_STR.ix[VAR_STR.VAR_STR == 0, 'VAR_STR'] = np.nan
|
conala
|
20490274-12
|
reset index to default in dataframe `df`
|
df = df.reset_index(drop=True)
|
[
"pandas.reference.api.pandas.dataframe.reset_index"
] |
VAR_STR = VAR_STR.reset_index(drop=True)
|
conala
|
13905936-21
|
create a list containing digits of number 123 as its elements
|
list(str(123))
|
[
"python.library.functions#list",
"python.library.stdtypes#str"
] |
list(str(123))
|
conala
|
13905936-57
|
converting integer `num` to list
|
[int(x) for x in str(num)]
|
[
"python.library.functions#int",
"python.library.stdtypes#str"
] |
[int(x) for x in str(VAR_STR)]
|
conala
|
17815945-94
|
convert generator object to a dictionary
|
{i: (i * 2) for i in range(10)}
|
[
"python.library.functions#range"
] |
{i: (i * 2) for i in range(10)}
|
conala
|
17815945-66
|
convert generator object to a dictionary
|
dict((i, i * 2) for i in range(10))
|
[
"python.library.functions#range",
"python.library.stdtypes#dict"
] |
dict((i, i * 2) for i in range(10))
|
conala
|
17027690-44
|
skip the newline while printing `line`
|
print(line.rstrip('\n'))
|
[
"python.library.stdtypes#str.rstrip"
] |
print(VAR_STR.rstrip('\n'))
|
conala
|
42364593-66
|
move dictionaries in list `lst` to the end of the list if value of key 'language' in each dictionary is not equal to 'en'
|
sorted(lst, key=lambda x: x['language'] != 'en')
|
[
"python.library.functions#sorted"
] |
sorted(VAR_STR, key=lambda x: x['VAR_STR'] != 'VAR_STR')
|
conala
|
2918362-2
|
writing string 'text to write\n' to file `f`
|
f.write('text to write\n')
|
[
"python.library.os#os.write"
] |
VAR_STR.write('VAR_STR')
|
conala
|
2918362-26
|
Write a string `My String` to a file `file` including new line character
|
file.write('My String\n')
|
[
"python.library.os#os.write"
] |
VAR_STR.write('My String\n')
|
conala
|
40582103-88
|
use regex pattern '((.+?)\\2+)' to split string '44442(2)2(2)44'
|
[m[0] for m in re.compile('((.+?)\\2+)').findall('44442(2)2(2)44')]
|
[
"python.library.re#re.compile",
"python.library.re#re.findall"
] |
[m[0] for m in re.compile('VAR_STR').findall('VAR_STR')]
|
conala
|
40582103-64
|
use regular expression '((\\d)(?:[()]*\\2*[()]*)*)' to split string `s`
|
[i[0] for i in re.findall('((\\d)(?:[()]*\\2*[()]*)*)', s)]
|
[
"python.library.re#re.findall"
] |
[i[0] for i in re.findall('VAR_STR', VAR_STR)]
|
conala
|
20735384-98
|
add character '@' after word 'get' in string `text`
|
text = re.sub('(\\bget\\b)', '\\1@', text)
|
[
"python.library.re#re.sub"
] |
VAR_STR = re.sub('(\\bget\\b)', '\\1@', VAR_STR)
|
conala
|
715550-30
|
serialize dictionary `d` as a JSON formatted string with each key formatted to pattern '%d,%d'
|
simplejson.dumps(dict([('%d,%d' % k, v) for k, v in list(d.items())]))
|
[
"python.library.stdtypes#dict",
"python.library.functions#list",
"python.library.stdtypes#dict.items",
"python.library.json#json.dumps"
] |
simplejson.dumps(dict([('VAR_STR' % k, v) for k, v in list(VAR_STR.items())]))
|
conala
|
4020539-78
|
decode escape sequences in string `myString`
|
myString.decode('string_escape')
|
[
"python.library.stdtypes#bytearray.decode"
] |
VAR_STR.decode('string_escape')
|
conala
|
33724111-3
|
remove colon character surrounded by vowels letters in string `word`
|
word = re.sub('([aeiou]):(([aeiou][^aeiou]*){3})$', '\\1\\2', word)
|
[
"python.library.re#re.sub"
] |
VAR_STR = re.sub('([aeiou]):(([aeiou][^aeiou]*){3})$', '\\1\\2', VAR_STR)
|
conala
|
11073609-16
|
group dataframe `df` based on minute interval
|
df.groupby(df.index.map(lambda t: t.minute))
|
[
"pandas.reference.api.pandas.dataframe.groupby",
"pandas.reference.api.pandas.index.map"
] |
VAR_STR.groupby(VAR_STR.index.map(lambda t: t.minute))
|
conala
|
9733638-44
|
Execute a post request to url `http://httpbin.org/post` with json data `{'test': 'cheers'}`
|
requests.post('http://httpbin.org/post', json={'test': 'cheers'})
|
[
"pygame.ref.fastevent#pygame.fastevent.post"
] |
requests.post('VAR_STR', json={VAR_STR})
|
conala
|
817122-45
|
delete all digits in string `s` that are not directly attached to a word character
|
re.sub('$\\d+\\W+|\\b\\d+\\b|\\W+\\d+$', '', s)
|
[
"python.library.re#re.sub"
] |
re.sub('$\\d+\\W+|\\b\\d+\\b|\\W+\\d+$', '', VAR_STR)
|
conala
|
817122-20
|
delete digits at the end of string `s`
|
re.sub('\\b\\d+\\b', '', s)
|
[
"python.library.re#re.sub"
] |
re.sub('\\b\\d+\\b', '', VAR_STR)
|
conala
|
817122-0
|
Delete self-contained digits from string `s`
|
s = re.sub('^\\d+\\s|\\s\\d+\\s|\\s\\d+$', ' ', s)
|
[
"python.library.re#re.sub"
] |
VAR_STR = re.sub('^\\d+\\s|\\s\\d+\\s|\\s\\d+$', ' ', VAR_STR)
|
conala
|
37125495-30
|
get the maximum 2 values per row in array `A`
|
A[:, -2:]
|
[] |
VAR_STR[:, -2:]
|
conala
|
15661013-5
|
convert date `my_date` to datetime
|
datetime.datetime.combine(my_date, datetime.time.min)
|
[
"python.library.datetime#datetime.datetime.combine"
] |
datetime.datetime.combine(VAR_STR, datetime.time.min)
|
conala
|
4706499-19
|
append line "appended text" to file "test.txt"
|
with open('test.txt', 'a') as myfile:
myfile.write('appended text')
|
[
"python.library.urllib.request#open",
"python.library.os#os.write"
] |
with open('VAR_STR', 'a') as myfile:
myfile.write('VAR_STR')
|
conala
|
4706499-84
|
append line "cool beans..." to file "foo"
|
with open('foo', 'a') as f:
f.write('cool beans...')
|
[
"python.library.urllib.request#open",
"python.library.os#os.write"
] |
with open('VAR_STR', 'a') as f:
f.write('VAR_STR')
|
conala
|
4706499-88
|
append to file 'test1' content 'koko'
|
with open('test1', 'ab') as f:
pass
|
[
"python.library.urllib.request#open"
] |
with open('VAR_STR', 'ab') as f:
pass
|
conala
|
4706499-97
|
append to file 'test' content 'koko'
|
open('test', 'a+b').write('koko')
|
[
"python.library.urllib.request#open",
"python.library.os#os.write"
] |
open('VAR_STR', 'a+b').write('VAR_STR')
|
conala
|
7142062-27
|
get the name of function `func` as a string
|
print(func.__name__)
|
[] |
print(VAR_STR.__name__)
|
conala
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.