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 |
---|---|---|---|---|---|
20048987-61
|
print a floating point number 2.345e-67 without any truncation
|
print('{:.100f}'.format(2.345e-67))
|
[
"python.library.functions#format"
] |
print('{:.100f}'.format(2.345e-67))
|
conala
|
4574509-95
|
remove duplicate characters from string 'ffffffbbbbbbbqqq'
|
re.sub('([a-z])\\1+', '\\1', 'ffffffbbbbbbbqqq')
|
[
"python.library.re#re.sub"
] |
re.sub('([a-z])\\1+', '\\1', 'VAR_STR')
|
conala
|
1059559-41
|
split string "a;bcd,ef g" on delimiters ';' and ','
|
"""a;bcd,ef g""".replace(';', ' ').replace(',', ' ').split()
|
[
"python.library.stdtypes#str.replace"
] |
"""VAR_STR""".replace('VAR_STR', ' ').replace('VAR_STR', ' ').split()
|
conala
|
17424182-56
|
extract all rows from dataframe `data` where the value of column 'Value' is True
|
data[data['Value'] == True]
|
[] |
VAR_STR[VAR_STR['VAR_STR'] == True]
|
conala
|
9505526-67
|
split string `s` into strings of repeating elements
|
print([a for a, b in re.findall('((\\w)\\2*)', s)])
|
[
"python.library.re#re.findall"
] |
print([a for a, b in re.findall('((\\w)\\2*)', VAR_STR)])
|
conala
|
761804-99
|
trim string " Hello "
|
' Hello '.strip()
|
[
"python.library.stdtypes#str.strip"
] |
""" Hello """.strip()
|
conala
|
761804-12
|
trim string `myString `
|
myString.strip()
|
[
"python.library.stdtypes#str.strip"
] |
VAR_STR.strip()
|
conala
|
761804-69
|
Trimming a string " Hello "
|
' Hello '.strip()
|
[
"python.library.stdtypes#str.strip"
] |
""" Hello """.strip()
|
conala
|
761804-7
|
Trimming a string " Hello"
|
' Hello'.strip()
|
[
"python.library.stdtypes#str.strip"
] |
""" Hello""".strip()
|
conala
|
761804-31
|
Trimming a string "Bob has a cat"
|
'Bob has a cat'.strip()
|
[
"python.library.stdtypes#str.strip"
] |
"""VAR_STR""".strip()
|
conala
|
761804-4
|
Trimming a string " Hello "
|
' Hello '.strip()
|
[
"python.library.stdtypes#str.strip"
] |
""" Hello """.strip()
|
conala
|
761804-26
|
Trimming a string `str`
|
str.strip()
|
[
"python.library.stdtypes#str.strip"
] |
VAR_STR.strip()
|
conala
|
761804-11
|
Trimming "\n" from string `myString`
|
myString.strip('\n')
|
[
"python.library.stdtypes#str.strip"
] |
VAR_STR.strip('VAR_STR')
|
conala
|
761804-12
|
left trimming "\n\r" from string `myString`
|
myString.lstrip('\n\r')
|
[
"python.library.stdtypes#str.strip"
] |
VAR_STR.lstrip('VAR_STR')
|
conala
|
761804-51
|
right trimming "\n\t" from string `myString`
|
myString.rstrip('\n\t')
|
[
"python.library.stdtypes#str.rstrip"
] |
VAR_STR.rstrip('VAR_STR')
|
conala
|
761804-50
|
Trimming a string " Hello\n" by space
|
' Hello\n'.strip(' ')
|
[
"python.library.stdtypes#str.strip"
] |
""" Hello
""".strip(' ')
|
conala
|
3518778-98
|
read csv file 'my_file.csv' into numpy array
|
my_data = genfromtxt('my_file.csv', delimiter=',')
|
[
"numpy.reference.generated.numpy.genfromtxt"
] |
my_data = genfromtxt('VAR_STR', delimiter=',')
|
conala
|
3518778-46
|
read csv file 'myfile.csv' into array
|
df = pd.read_csv('myfile.csv', sep=',', header=None)
|
[
"pandas.reference.api.pandas.read_csv"
] |
df = pd.read_csv('VAR_STR', sep=',', header=None)
|
conala
|
3518778-91
|
read csv file 'myfile.csv' into array
|
np.genfromtxt('myfile.csv', delimiter=',')
|
[
"numpy.reference.generated.numpy.genfromtxt"
] |
np.genfromtxt('VAR_STR', delimiter=',')
|
conala
|
3518778-42
|
read csv file 'myfile.csv' into array
|
np.genfromtxt('myfile.csv', delimiter=',', dtype=None)
|
[
"numpy.reference.generated.numpy.genfromtxt"
] |
np.genfromtxt('VAR_STR', delimiter=',', dtype=None)
|
conala
|
22702760-34
|
multiply column 'A' and column 'B' by column 'C' in datafram `df`
|
df[['A', 'B']].multiply(df['C'], axis='index')
|
[
"numpy.reference.generated.numpy.multiply"
] |
VAR_STR[['VAR_STR', 'VAR_STR']].multiply(VAR_STR['VAR_STR'], axis='index')
|
conala
|
10525301-35
|
Normalize string `str` from 'cp1252' code to 'utf-8' code
|
print(str.encode('cp1252').decode('utf-8').encode('cp1252').decode('utf-8'))
|
[
"python.library.stdtypes#str.encode",
"pandas.reference.api.pandas.series.str.decode"
] |
print(VAR_STR.encode('VAR_STR').decode('VAR_STR').encode('VAR_STR').decode('VAR_STR'))
|
conala
|
3294889-83
|
Iterating over a dictionary `d` using for loops
|
for (key, value) in d.items():
pass
|
[
"python.library.stdtypes#dict.items"
] |
for key, value in VAR_STR.items():
pass
|
conala
|
3294889-61
|
Iterating over a dictionary `d` using for loops
|
for (key, value) in list(d.items()):
pass
|
[
"python.library.functions#list",
"python.library.stdtypes#dict.items"
] |
for key, value in list(VAR_STR.items()):
pass
|
conala
|
3294889-5
|
Iterating key and items over dictionary `d`
|
for (letter, number) in list(d.items()):
pass
|
[
"python.library.functions#list",
"python.library.stdtypes#dict.items"
] |
for letter, number in list(VAR_STR.items()):
pass
|
conala
|
3294889-67
|
Iterating key and items over dictionary `d`
|
for (k, v) in list(d.items()):
pass
|
[
"python.library.functions#list",
"python.library.stdtypes#dict.items"
] |
for k, v in list(VAR_STR.items()):
pass
|
conala
|
3294889-59
|
get keys and items of dictionary `d`
|
list(d.items())
|
[
"python.library.functions#list",
"python.library.stdtypes#dict.items"
] |
list(VAR_STR.items())
|
conala
|
3294889-5
|
get keys and items of dictionary `d` as a list
|
list(d.items())
|
[
"python.library.functions#list",
"python.library.stdtypes#dict.items"
] |
list(VAR_STR.items())
|
conala
|
3294889-54
|
Iterating key and items over dictionary `d`
|
for (k, v) in list(d.items()):
pass
|
[
"python.library.functions#list",
"python.library.stdtypes#dict.items"
] |
for k, v in list(VAR_STR.items()):
pass
|
conala
|
3294889-3
|
Iterating key and items over dictionary `d`
|
for (letter, number) in list(d.items()):
pass
|
[
"python.library.functions#list",
"python.library.stdtypes#dict.items"
] |
for letter, number in list(VAR_STR.items()):
pass
|
conala
|
3294889-25
|
Iterating key and items over dictionary `d`
|
for (letter, number) in list(d.items()):
pass
|
[
"python.library.functions#list",
"python.library.stdtypes#dict.items"
] |
for letter, number in list(VAR_STR.items()):
pass
|
conala
|
7356042-14
|
Create 2D numpy array from the data provided in 'somefile.csv' with each row in the file having same number of values
|
X = numpy.loadtxt('somefile.csv', delimiter=',')
|
[
"numpy.reference.generated.numpy.loadtxt"
] |
X = numpy.loadtxt('VAR_STR', delimiter=',')
|
conala
|
1946181-83
|
control the keyboard and mouse with dogtail in linux
|
dogtail.rawinput.click(100, 100)
|
[] |
dogtail.rawinput.click(100, 100)
|
conala
|
2040038-20
|
sort datetime objects `birthdays` by `month` and `day`
|
birthdays.sort(key=lambda d: (d.month, d.day))
|
[
"python.library.stdtypes#list.sort"
] |
VAR_STR.sort(key=lambda d: (d.VAR_STR, d.VAR_STR))
|
conala
|
275018-37
|
remove trailing newline in string "test string\n"
|
'test string\n'.rstrip()
|
[
"python.library.stdtypes#str.rstrip"
] |
"""VAR_STR""".rstrip()
|
conala
|
275018-63
|
remove trailing newline in string 'test string \n\n'
|
'test string \n\n'.rstrip('\n')
|
[
"python.library.stdtypes#str.rstrip"
] |
"""VAR_STR""".rstrip('\n')
|
conala
|
275018-98
|
remove newline in string `s`
|
s.strip()
|
[
"python.library.stdtypes#str.strip"
] |
VAR_STR.strip()
|
conala
|
275018-8
|
remove newline in string `s` on the right side
|
s.rstrip()
|
[
"python.library.stdtypes#str.rstrip"
] |
VAR_STR.rstrip()
|
conala
|
275018-64
|
remove newline in string `s` on the left side
|
s.lstrip()
|
[
"python.library.stdtypes#str.lstrip"
] |
VAR_STR.lstrip()
|
conala
|
275018-9
|
remove newline in string 'Mac EOL\r'
|
'Mac EOL\r'.rstrip('\r\n')
|
[
"python.library.stdtypes#str.rstrip"
] |
"""VAR_STR""".rstrip('\r\n')
|
conala
|
275018-25
|
remove newline in string 'Windows EOL\r\n' on the right side
|
'Windows EOL\r\n'.rstrip('\r\n')
|
[
"python.library.stdtypes#str.rstrip"
] |
"""VAR_STR""".rstrip('\r\n')
|
conala
|
275018-43
|
remove newline in string 'Unix EOL\n' on the right side
|
'Unix EOL\n'.rstrip('\r\n')
|
[
"python.library.stdtypes#str.rstrip"
] |
"""VAR_STR""".rstrip('\r\n')
|
conala
|
275018-58
|
remove newline in string "Hello\n\n\n" on the right side
|
'Hello\n\n\n'.rstrip('\n')
|
[
"python.library.stdtypes#str.rstrip"
] |
"""VAR_STR""".rstrip('\n')
|
conala
|
15530399-12
|
split string `text` by the occurrences of regex pattern '(?<=\\?|!|\\.)\\s{0,2}(?=[A-Z]|$)'
|
re.split('(?<=\\?|!|\\.)\\s{0,2}(?=[A-Z]|$)', text)
|
[
"python.library.re#re.split"
] |
re.split('VAR_STR', VAR_STR)
|
conala
|
186857-59
|
split a string `s` by ';' and convert to a dictionary
|
dict(item.split('=') for item in s.split(';'))
|
[
"python.library.stdtypes#dict",
"python.library.stdtypes#str.split"
] |
dict(item.split('=') for item in VAR_STR.split('VAR_STR'))
|
conala
|
17117912-75
|
create a list where each element is a value of the key 'Name' for each dictionary `d` in the list `thisismylist`
|
[d['Name'] for d in thisismylist]
|
[] |
[VAR_STR['VAR_STR'] for VAR_STR in VAR_STR]
|
conala
|
17117912-14
|
create a list of tuples with the values of keys 'Name' and 'Age' from each dictionary `d` in the list `thisismylist`
|
[(d['Name'], d['Age']) for d in thisismylist]
|
[] |
[(VAR_STR['VAR_STR'], VAR_STR['VAR_STR']) for VAR_STR in VAR_STR]
|
conala
|
8650415-85
|
Reverse key-value pairs in a dictionary `map`
|
dict((v, k) for k, v in map.items())
|
[
"python.library.stdtypes#dict",
"python.library.stdtypes#dict.items"
] |
dict((v, k) for k, v in VAR_STR.items())
|
conala
|
19153328-63
|
assign value in `group` dynamically to class property `attr`
|
setattr(self, attr, group)
|
[
"python.library.functions#setattr"
] |
setattr(self, VAR_STR, VAR_STR)
|
conala
|
17627531-50
|
sort list of date strings 'd'
|
sorted(d, key=lambda x: datetime.datetime.strptime(x, '%m-%Y'))
|
[
"python.library.datetime#datetime.datetime.strptime",
"python.library.functions#sorted"
] |
sorted(VAR_STR, key=lambda x: datetime.datetime.strptime(x, '%m-%Y'))
|
conala
|
6159313-36
|
test if either of strings `a` or `b` are members of the set of strings, `['b', 'a', 'foo', 'bar']`
|
set(['a', 'b']).issubset(['b', 'a', 'foo', 'bar'])
|
[
"python.library.stdtypes#set",
"python.library.stdtypes#frozenset.issubset"
] |
set(['VAR_STR', 'VAR_STR']).issubset(['VAR_STR', 'VAR_STR', 'foo', 'bar'])
|
conala
|
6159313-37
|
Check if all the values in a list `['a', 'b']` are present in another list `['b', 'a', 'foo', 'bar']`
|
all(x in ['b', 'a', 'foo', 'bar'] for x in ['a', 'b'])
|
[
"python.library.functions#all"
] |
all(x in [VAR_STR] for x in [VAR_STR])
|
conala
|
17306755-9
|
format float `3.5e+20` to `$3.5 \\times 10^{20}$` and set as title of matplotlib plot `ax`
|
ax.set_title('$%s \\times 10^{%s}$' % ('3.5', '+20'))
|
[
"matplotlib.legend_api#matplotlib.legend.Legend.set_title"
] |
VAR_STR.set_title('$%s \\times 10^{%s}$' % ('3.5', '+20'))
|
conala
|
24659239-4
|
set text color as `red` and background color as `#A3C1DA` in qpushbutton
|
setStyleSheet('QPushButton {background-color: #A3C1DA; color: red;}')
|
[] |
setStyleSheet('QPushButton {background-color: #A3C1DA; color: red;}')
|
conala
|
12201577-67
|
convert an rgb image 'messi5.jpg' into grayscale `img`
|
img = cv2.imread('messi5.jpg', 0)
|
[
"matplotlib.image_api#matplotlib.image.imread"
] |
VAR_STR = cv2.imread('VAR_STR', 0)
|
conala
|
4411811-39
|
create list `levels` containing 3 empty dictionaries
|
levels = [{}, {}, {}]
|
[] |
VAR_STR = [{}, {}, {}]
|
conala
|
1713594-63
|
parse string '01-Jan-1995' into a datetime object using format '%d-%b-%Y'
|
datetime.datetime.strptime('01-Jan-1995', '%d-%b-%Y')
|
[
"python.library.datetime#datetime.datetime.strptime"
] |
datetime.datetime.strptime('VAR_STR', 'VAR_STR')
|
conala
|
7768859-33
|
Convert integer elements in list `wordids` to strings
|
[str(wi) for wi in wordids]
|
[
"python.library.stdtypes#str"
] |
[str(wi) for wi in VAR_STR]
|
conala
|
16099694-63
|
get a list `cleaned` that contains all non-empty elements in list `your_list`
|
cleaned = [x for x in your_list if x]
|
[] |
VAR_STR = [x for x in VAR_STR if x]
|
conala
|
17038426-88
|
split a string `yas` based on tab '\t'
|
re.split('\\t+', yas.rstrip('\t'))
|
[
"python.library.re#re.split",
"python.library.stdtypes#str.rstrip"
] |
re.split('\\t+', VAR_STR.rstrip('VAR_STR'))
|
conala
|
34197047-67
|
sorting the lists in list of lists `data`
|
[sorted(item) for item in data]
|
[
"python.library.functions#sorted"
] |
[sorted(item) for item in VAR_STR]
|
conala
|
22741068-41
|
remove identical items from list `my_list` and sort it alphabetically
|
sorted(set(my_list))
|
[
"python.library.functions#sorted",
"python.library.stdtypes#set"
] |
sorted(set(VAR_STR))
|
conala
|
35017035-30
|
convert a list of lists `a` into list of tuples of appropriate elements form nested lists
|
zip(*a)
|
[
"python.library.functions#zip"
] |
zip(*VAR_STR)
|
conala
|
7595148-31
|
converting hex string `s` to its integer representations
|
[ord(c) for c in s.decode('hex')]
|
[
"python.library.functions#ord",
"python.library.stdtypes#bytearray.decode"
] |
[ord(c) for c in VAR_STR.decode('hex')]
|
conala
|
41386443-67
|
create pandas data frame `df` from txt file `filename.txt` with column `Region Name` and separator `;`
|
df = pd.read_csv('filename.txt', sep=';', names=['Region Name'])
|
[
"pandas.reference.api.pandas.read_csv"
] |
VAR_STR = pd.read_csv('VAR_STR', sep='VAR_STR', names=['VAR_STR'])
|
conala
|
14657241-69
|
get a list of all the duplicate items in dataframe `df` using pandas
|
pd.concat(g for _, g in df.groupby('ID') if len(g) > 1)
|
[
"pandas.reference.api.pandas.dataframe.groupby",
"pandas.reference.api.pandas.concat",
"python.library.functions#len"
] |
pd.concat(g for _, g in VAR_STR.groupby('ID') if len(g) > 1)
|
conala
|
930865-13
|
sort objects in model `Profile` based on Theirs `reputation` attribute
|
sorted(Profile.objects.all(), key=lambda p: p.reputation)
|
[
"python.library.functions#sorted",
"python.library.functions#all"
] |
sorted(VAR_STR.objects.all(), key=lambda p: p.VAR_STR)
|
conala
|
20585920-51
|
for a dictionary `a`, set default value for key `somekey` as list and append value `bob` in that key
|
a.setdefault('somekey', []).append('bob')
|
[
"python.library.stdtypes#dict.setdefault",
"numpy.reference.generated.numpy.append"
] |
VAR_STR.setdefault('VAR_STR', []).append('VAR_STR')
|
conala
|
3984539-10
|
replace white spaces in string ' a\n b\n c\nd e' with empty string ''
|
re.sub('(?m)^[^\\S\\n]+', '', ' a\n b\n c\nd e')
|
[
"python.library.re#re.sub"
] |
re.sub('(?m)^[^\\S\\n]+', 'VAR_STR', ' a\n b\n c\nd e')
|
conala
|
3984539-99
|
remove white spaces from all the lines using a regular expression in string 'a\n b\n c'
|
re.sub('(?m)^\\s+', '', 'a\n b\n c')
|
[
"python.library.re#re.sub"
] |
re.sub('(?m)^\\s+', '', 'VAR_STR')
|
conala
|
17141558-7
|
sort dataframe `df` based on column 'b' in ascending and column 'c' in descending
|
df.sort_values(['b', 'c'], ascending=[True, False], inplace=True)
|
[
"pandas.reference.api.pandas.dataframe.sort_values"
] |
VAR_STR.sort_values(['VAR_STR', 'VAR_STR'], ascending=[True, False], inplace=True)
|
conala
|
17141558-84
|
sort dataframe `df` based on column 'a' in ascending and column 'b' in descending
|
df.sort_values(['a', 'b'], ascending=[True, False])
|
[
"pandas.reference.api.pandas.dataframe.sort_values"
] |
VAR_STR.sort_values(['VAR_STR', 'VAR_STR'], ascending=[True, False])
|
conala
|
17141558-74
|
sort a pandas data frame with column `a` in ascending and `b` in descending order
|
df1.sort(['a', 'b'], ascending=[True, False], inplace=True)
|
[
"python.library.stdtypes#list.sort"
] |
df1.sort(['VAR_STR', 'VAR_STR'], ascending=[True, False], inplace=True)
|
conala
|
17141558-89
|
sort a pandas data frame by column `a` in ascending, and by column `b` in descending order
|
df.sort(['a', 'b'], ascending=[True, False])
|
[
"pandas.reference.api.pandas.index.sort"
] |
df.sort(['VAR_STR', 'VAR_STR'], ascending=[True, False])
|
conala
|
1447575-49
|
create a symlink directory `D:\\testdirLink` for directory `D:\\testdir` with unicode support using ctypes library
|
kdll.CreateSymbolicLinkW('D:\\testdirLink', 'D:\\testdir', 1)
|
[] |
kdll.CreateSymbolicLinkW('VAR_STR', 'VAR_STR', 1)
|
conala
|
861190-38
|
Sort a list of dictionaries `mylist` by keys "weight" and "factor"
|
mylist.sort(key=operator.itemgetter('weight', 'factor'))
|
[
"python.library.operator#operator.itemgetter",
"python.library.stdtypes#list.sort"
] |
VAR_STR.sort(key=operator.itemgetter('VAR_STR', 'VAR_STR'))
|
conala
|
861190-31
|
ordering a list of dictionaries `mylist` by elements 'weight' and 'factor'
|
mylist.sort(key=lambda d: (d['weight'], d['factor']))
|
[
"python.library.stdtypes#list.sort"
] |
VAR_STR.sort(key=lambda d: (d['VAR_STR'], d['VAR_STR']))
|
conala
|
8081545-50
|
convert tuple elements in list `[(1,2),(3,4),(5,6),]` into lists
|
map(list, zip(*[(1, 2), (3, 4), (5, 6)]))
|
[
"python.library.functions#zip",
"python.library.functions#map"
] |
map(list, zip(*[(1, 2), (3, 4), (5, 6)]))
|
conala
|
8081545-98
|
convert list of tuples to multiple lists in Python
|
map(list, zip(*[(1, 2), (3, 4), (5, 6)]))
|
[
"python.library.functions#zip",
"python.library.functions#map"
] |
map(list, zip(*[(1, 2), (3, 4), (5, 6)]))
|
conala
|
8081545-96
|
convert list of tuples to multiple lists in Python
|
zip(*[(1, 2), (3, 4), (5, 6)])
|
[
"python.library.functions#zip"
] |
zip(*[(1, 2), (3, 4), (5, 6)])
|
conala
|
4965159-23
|
execute os command `my_cmd`
|
os.system(my_cmd)
|
[
"python.library.os#os.system"
] |
os.system(VAR_STR)
|
conala
|
4793617-92
|
derive the week start for the given week number and year ‘2011, 4, 0’
|
datetime.datetime.strptime('2011, 4, 0', '%Y, %U, %w')
|
[
"python.library.datetime#datetime.datetime.strptime"
] |
datetime.datetime.strptime('2011, 4, 0', '%Y, %U, %w')
|
conala
|
21350605-24
|
python selenium click on button '.button.c_button.s_button'
|
driver.find_element_by_css_selector('.button.c_button.s_button').click()
|
[] |
driver.find_element_by_css_selector('VAR_STR').click()
|
conala
|
21350605-24
|
python selenium click on button
|
driver.find_element_by_css_selector('.button .c_button .s_button').click()
|
[] |
driver.find_element_by_css_selector('.button .c_button .s_button').click()
|
conala
|
30190459-31
|
read CSV file 'my.csv' into a dataframe `df` with datatype of float for column 'my_column' considering character 'n/a' as NaN value
|
df = pd.read_csv('my.csv', dtype={'my_column': np.float64}, na_values=['n/a'])
|
[
"pandas.reference.api.pandas.read_csv"
] |
VAR_STR = pd.read_csv('VAR_STR', dtype={'VAR_STR': np.float64}, na_values=['VAR_STR'])
|
conala
|
30190459-15
|
convert nan values to ‘n/a’ while reading rows from a csv `read_csv` with pandas
|
df = pd.read_csv('my.csv', na_values=['n/a'])
|
[
"pandas.reference.api.pandas.read_csv"
] |
df = pd.VAR_STR('my.csv', na_values=['n/a'])
|
conala
|
13076560-88
|
get indexes of all true boolean values from a list `bool_list`
|
[i for i, elem in enumerate(bool_list, 1) if elem]
|
[
"python.library.functions#enumerate"
] |
[i for i, elem in enumerate(VAR_STR, 1) if elem]
|
conala
|
3159155-97
|
get a list `no_integers` of all the items in list `mylist` that are not of type `int`
|
no_integers = [x for x in mylist if not isinstance(x, int)]
|
[
"python.library.functions#isinstance"
] |
VAR_STR = [x for x in VAR_STR if not isinstance(x, VAR_STR)]
|
conala
|
5618878-38
|
concatenating values in `list1` to a string
|
str1 = ''.join(list1)
|
[
"python.library.stdtypes#str.join"
] |
str1 = ''.join(VAR_STR)
|
conala
|
5618878-35
|
concatenating values in list `L` to a string, separate by space
|
' '.join((str(x) for x in L))
|
[
"python.library.stdtypes#str",
"python.library.stdtypes#str.join"
] |
""" """.join(str(x) for x in VAR_STR)
|
conala
|
5618878-66
|
concatenating values in `list1` to a string
|
str1 = ''.join((str(e) for e in list1))
|
[
"python.library.stdtypes#str",
"python.library.stdtypes#str.join"
] |
str1 = ''.join(str(e) for e in VAR_STR)
|
conala
|
5618878-26
|
concatenating values in list `L` to a string
|
makeitastring = ''.join(map(str, L))
|
[
"python.library.functions#map",
"python.library.stdtypes#str.join"
] |
makeitastring = ''.join(map(str, VAR_STR))
|
conala
|
14358567-16
|
find consecutive segments from a column 'A' in a pandas data frame 'df'
|
df.reset_index().groupby('A')['index'].apply(np.array)
|
[
"pandas.reference.api.pandas.dataframe.reset_index",
"pandas.reference.api.pandas.dataframe.apply",
"pandas.reference.api.pandas.dataframe.groupby"
] |
VAR_STR.reset_index().groupby('VAR_STR')['index'].apply(np.array)
|
conala
|
26155985-7
|
place '\' infront of each non-letter char in string `line`
|
print(re.sub('[_%^$]', '\\\\\\g<0>', line))
|
[
"python.library.re#re.sub"
] |
print(re.sub('[_%^$]', '\\\\\\g<0>', VAR_STR))
|
conala
|
8459231-72
|
sort a list of tuples `my_list` by second parameter in the tuple
|
my_list.sort(key=lambda x: x[1])
|
[
"python.library.stdtypes#list.sort"
] |
VAR_STR.sort(key=lambda x: x[1])
|
conala
|
5788891-79
|
execute a file './abc.py' with arguments `arg1` and `arg2` in python shell
|
subprocess.call(['./abc.py', arg1, arg2])
|
[
"python.library.subprocess#subprocess.call"
] |
subprocess.call(['VAR_STR', VAR_STR, VAR_STR])
|
conala
|
8569201-37
|
find the string matches within parenthesis from a string `s` using regex
|
m = re.search('\\[(\\w+)\\]', s)
|
[
"python.library.re#re.search"
] |
m = re.search('\\[(\\w+)\\]', VAR_STR)
|
conala
|
19365513-49
|
Add row `['8/19/2014', 'Jun', 'Fly', '98765']` to dataframe `df`
|
df.loc[len(df)] = ['8/19/2014', 'Jun', 'Fly', '98765']
|
[
"pandas.reference.api.pandas.dataframe.loc",
"python.library.functions#len"
] |
VAR_STR.loc[len(VAR_STR)] = [VAR_STR]
|
conala
|
4182603-40
|
decode the string 'stringnamehere' to UTF-8
|
stringnamehere.decode('utf-8', 'ignore')
|
[
"python.library.stdtypes#bytearray.decode"
] |
VAR_STR.decode('utf-8', 'ignore')
|
conala
|
6539881-93
|
convert string `apple` from iso-8859-1/latin1 to utf-8
|
apple.decode('iso-8859-1').encode('utf8')
|
[
"python.library.stdtypes#str.encode",
"python.library.stdtypes#bytearray.decode"
] |
VAR_STR.decode('iso-8859-1').encode('utf8')
|
conala
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.