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 |
---|---|---|---|---|---|
4029436-9
|
create a list containing the subtraction of each item in list `L` from the item prior to it
|
[(y - x) for x, y in zip(L, L[1:])]
|
[
"python.library.functions#zip"
] |
[(y - x) for x, y in zip(VAR_STR, VAR_STR[1:])]
|
conala
|
31547657-16
|
sympy solve matrix of linear equations `(([1, 1, 1, 1], [1, 1, 2, 3]))` with variables `(x, y, z)`
|
linsolve(Matrix(([1, 1, 1, 1], [1, 1, 2, 3])), (x, y, z))
|
[
"numpy.reference.generated.numpy.matrix"
] |
linsolve(Matrix(VAR_STR), (VAR_STR))
|
conala
|
27060098-88
|
replacing 'ABC' and 'AB' values in column 'BrandName' of dataframe `df` with 'A'
|
df['BrandName'].replace(['ABC', 'AB'], 'A')
|
[
"python.library.stdtypes#str.replace"
] |
VAR_STR['VAR_STR'].replace(['VAR_STR', 'VAR_STR'], 'VAR_STR')
|
conala
|
27060098-9
|
replace values `['ABC', 'AB']` in a column 'BrandName' of pandas dataframe `df` with another value 'A'
|
df['BrandName'] = df['BrandName'].replace(['ABC', 'AB'], 'A')
|
[
"python.library.stdtypes#str.replace"
] |
VAR_STR['VAR_STR'] = VAR_STR['VAR_STR'].replace([VAR_STR], 'VAR_STR')
|
conala
|
29311354-62
|
Set time zone `Europe/Istanbul` in Django
|
TIME_ZONE = 'Europe/Istanbul'
|
[] |
TIME_ZONE = 'VAR_STR'
|
conala
|
9618050-97
|
match regex pattern 'TAA(?:[ATGC]{3})+?TAA' on string `seq`
|
re.findall('TAA(?:[ATGC]{3})+?TAA', seq)
|
[
"python.library.re#re.findall"
] |
re.findall('VAR_STR', VAR_STR)
|
conala
|
41071947-3
|
remove the space between subplots in matplotlib.pyplot
|
fig.subplots_adjust(wspace=0, hspace=0)
|
[
"matplotlib.figure_api#matplotlib.figure.FigureBase.subplots_adjust"
] |
fig.subplots_adjust(wspace=0, hspace=0)
|
conala
|
8153631-25
|
convert js date object 'Tue, 22 Nov 2011 06:00:00 GMT' to python datetime
|
datetime.strptime('Tue, 22 Nov 2011 06:00:00 GMT', '%a, %d %b %Y %H:%M:%S %Z')
|
[
"python.library.datetime#datetime.datetime.strptime"
] |
datetime.strptime('VAR_STR', '%a, %d %b %Y %H:%M:%S %Z')
|
conala
|
40744328-73
|
order a list of lists `l1` by the first value
|
l1.sort(key=lambda x: int(x[0]))
|
[
"python.library.functions#int",
"python.library.stdtypes#list.sort"
] |
VAR_STR.sort(key=lambda x: int(x[0]))
|
conala
|
40744328-93
|
order a list of lists `[[1, 'mike'], [1, 'bob']]` by the first value of individual list
|
sorted([[1, 'mike'], [1, 'bob']])
|
[
"python.library.functions#sorted"
] |
sorted([VAR_STR])
|
conala
|
6586310-21
|
convert list of key-value tuples `[('A', 1), ('B', 2), ('C', 3)]` into dictionary
|
dict([('A', 1), ('B', 2), ('C', 3)])
|
[
"python.library.stdtypes#dict"
] |
dict([VAR_STR])
|
conala
|
10406130-25
|
Check if 3 is not in a list [2, 3, 4]
|
(3 not in [2, 3, 4])
|
[] |
3 not in [2, 3, 4]
|
conala
|
10406130-84
|
Check if tuple (2, 3) is not in a list [(2, 3), (5, 6), (9, 1)]
|
((2, 3) not in [(2, 3), (5, 6), (9, 1)])
|
[] |
(2, 3) not in [(2, 3), (5, 6), (9, 1)]
|
conala
|
10406130-41
|
Check if tuple (2, 3) is not in a list [(2, 7), (7, 3), "hi"]
|
((2, 3) not in [(2, 7), (7, 3), 'hi'])
|
[] |
(2, 3) not in [(2, 7), (7, 3), 'VAR_STR']
|
conala
|
10406130-74
|
Check if 3 is not in the list [4,5,6]
|
(3 not in [4, 5, 6])
|
[] |
3 not in [4, 5, 6]
|
conala
|
27744882-82
|
find consecutive consonants in a word `CONCENTRATION` using regex
|
re.findall('[bcdfghjklmnpqrstvwxyz]+', 'CONCERTATION', re.IGNORECASE)
|
[
"python.library.re#re.findall"
] |
re.findall('[bcdfghjklmnpqrstvwxyz]+', 'CONCERTATION', re.IGNORECASE)
|
conala
|
5254445-10
|
add string `-` in `4th` position of a string `s`
|
s[:4] + '-' + s[4:]
|
[] |
VAR_STR[:4] + 'VAR_STR' + VAR_STR[4:]
|
conala
|
39299703-19
|
check if character '-' exists in a dataframe `df` cell 'a'
|
df['a'].str.contains('-')
|
[
"pandas.reference.api.pandas.series.str.contains"
] |
VAR_STR['VAR_STR'].str.contains('VAR_STR')
|
conala
|
794995-38
|
Jinja2 formate date `item.date` accorto pattern 'Y M d'
|
{{(item.date | date): 'Y M d'}}
|
[] |
{{(item.date | date): 'VAR_STR'}}
|
conala
|
10664430-91
|
Convert long int `myNumber` into date and time represented in the the string format '%Y-%m-%d %H:%M:%S'
|
datetime.datetime.fromtimestamp(myNumber).strftime('%Y-%m-%d %H:%M:%S')
|
[
"python.library.datetime#datetime.datetime.fromtimestamp",
"python.library.datetime#datetime.datetime.strftime"
] |
datetime.datetime.fromtimestamp(VAR_STR).strftime('VAR_STR')
|
conala
|
13142347-60
|
remove leading and trailing zeros in the string 'your_Strip'
|
your_string.strip('0')
|
[
"python.library.stdtypes#str.strip"
] |
your_string.strip('0')
|
conala
|
19300174-53
|
destruct elements of list `[1, 2, 3]` to variables `a`, `b` and `c`
|
a, b, c = [1, 2, 3]
|
[] |
VAR_STR, VAR_STR, VAR_STR = [VAR_STR]
|
conala
|
40094588-66
|
get a list of characters in string `x` matching regex pattern `pattern`
|
print(re.findall(pattern, x))
|
[
"python.library.re#re.findall"
] |
print(re.findall(VAR_STR, VAR_STR))
|
conala
|
17277100-38
|
get a list `slice` of array slices of the first two rows and columns from array `arr`
|
slice = [arr[i][0:2] for i in range(0, 2)]
|
[
"python.library.functions#range"
] |
VAR_STR = [VAR_STR[i][0:2] for i in range(0, 2)]
|
conala
|
12808420-37
|
Create new list `result` by splitting each item in list `words`
|
result = [item for word in words for item in word.split(',')]
|
[
"python.library.stdtypes#str.split"
] |
VAR_STR = [item for word in VAR_STR for item in word.split(',')]
|
conala
|
42394627-10
|
sort list `lst` based on each element's number of occurrences
|
sorted(lst, key=lambda x: (-1 * c[x], lst.index(x)))
|
[
"python.library.functions#sorted",
"python.library.stdtypes#str.index"
] |
sorted(VAR_STR, key=lambda x: (-1 * c[x], VAR_STR.index(x)))
|
conala
|
21669374-19
|
convert string 'a' to hex
|
hex(ord('a'))
|
[
"python.library.functions#ord",
"python.library.functions#hex"
] |
hex(ord('VAR_STR'))
|
conala
|
3258573-36
|
Insert a character `-` after every two elements in a string `s`
|
"""-""".join(a + b for a, b in zip(s[::2], s[1::2]))
|
[
"python.library.functions#zip",
"python.library.stdtypes#str.join"
] |
"""VAR_STR""".join(a + b for a, b in zip(VAR_STR[::2], VAR_STR[1::2]))
|
conala
|
2847272-82
|
replace fields delimited by braces {} in string "Day old bread, 50% sale {0}" with string 'today'
|
"""Day old bread, 50% sale {0}""".format('today')
|
[
"python.library.functions#format"
] |
"""VAR_STR""".format('VAR_STR')
|
conala
|
13704860-74
|
zip two lists `[1, 2]` and `[3, 4]` into a list of two tuples containing elements at the same index in each list
|
zip([1, 2], [3, 4])
|
[
"python.library.functions#zip"
] |
zip([VAR_STR], [VAR_STR])
|
conala
|
37584492-24
|
remove all instances of parenthesesis containing text beginning with `as ` from string `line`
|
line = re.sub('\\(+as .*?\\) ', '', line)
|
[
"python.library.re#re.sub"
] |
VAR_STR = re.sub('\\(+as .*?\\) ', '', VAR_STR)
|
conala
|
16566069-85
|
decode url `url` with utf8 and print it
|
print(urllib.parse.unquote(url).decode('utf8'))
|
[
"python.library.urllib.parse#urllib.parse.unquote",
"python.library.stdtypes#bytearray.decode"
] |
print(urllib.parse.unquote(VAR_STR).decode('utf8'))
|
conala
|
16566069-92
|
decode a urllib escaped url string `url` with `utf8`
|
url = urllib.parse.unquote(url).decode('utf8')
|
[
"python.library.urllib.parse#urllib.parse.unquote",
"python.library.stdtypes#bytearray.decode"
] |
VAR_STR = urllib.parse.unquote(VAR_STR).decode('VAR_STR')
|
conala
|
2077897-31
|
substitute multiple whitespace with single whitespace in string `mystring`
|
""" """.join(mystring.split())
|
[
"python.library.stdtypes#str.join",
"python.library.stdtypes#str.split"
] |
""" """.join(VAR_STR.split())
|
conala
|
5749195-27
|
How can I split and parse a string in Python?
|
"""2.7.0_bf4fda703454""".split('_')
|
[
"python.library.stdtypes#str.split"
] |
"""2.7.0_bf4fda703454""".split('_')
|
conala
|
9376384-34
|
sort a list of tuples 'unsorted' based on two elements, second and third
|
sorted(unsorted, key=lambda element: (element[1], element[2]))
|
[
"python.library.functions#sorted"
] |
sorted(VAR_STR, key=lambda element: (element[1], element[2]))
|
conala
|
13837848-67
|
converting byte string `c` in unicode string
|
c.decode('unicode_escape')
|
[
"python.library.stdtypes#bytearray.decode"
] |
VAR_STR.decode('unicode_escape')
|
conala
|
9466017-43
|
sort list `files` based on variable `file_number`
|
files.sort(key=file_number)
|
[
"python.library.stdtypes#list.sort"
] |
VAR_STR.sort(key=VAR_STR)
|
conala
|
2953746-47
|
parse a comma-separated string number '1,000,000' into int
|
int('1,000,000'.replace(',', ''))
|
[
"python.library.functions#int",
"python.library.stdtypes#str.replace"
] |
int('VAR_STR'.replace(',', ''))
|
conala
|
13163145-86
|
multiply the columns of sparse matrix `m` by array `a` then multiply the rows of the resulting matrix by array `a`
|
numpy.dot(numpy.dot(a, m), a)
|
[
"numpy.reference.generated.numpy.dot"
] |
numpy.dot(numpy.dot(VAR_STR, VAR_STR), VAR_STR)
|
conala
|
70797-30
|
print "Please enter something: " to console, and read user input to `var`
|
var = input('Please enter something: ')
|
[
"python.library.functions#input"
] |
VAR_STR = input('Please enter something: ')
|
conala
|
8704952-19
|
convert a set of tuples `queryresult` to a string `emaillist`
|
emaillist = '\n'.join(item[0] for item in queryresult)
|
[
"python.library.stdtypes#str.join"
] |
VAR_STR = '\n'.join(item[0] for item in VAR_STR)
|
conala
|
8704952-43
|
convert a set of tuples `queryresult` to a list of strings
|
[item[0] for item in queryresult]
|
[] |
[item[0] for item in VAR_STR]
|
conala
|
8704952-35
|
convert a list of tuples `queryresult` to a string from the first indexes.
|
emaillist = '\n'.join([item[0] for item in queryresult])
|
[
"python.library.stdtypes#str.join"
] |
emaillist = '\n'.join([item[0] for item in VAR_STR])
|
conala
|
2759323-25
|
list the contents of a directory '/home/username/www/'
|
os.listdir('/home/username/www/')
|
[
"python.library.os#os.listdir"
] |
os.listdir('VAR_STR')
|
conala
|
2759323-64
|
list all the contents of the directory 'path'.
|
os.listdir('path')
|
[
"python.library.os#os.listdir"
] |
os.listdir('VAR_STR')
|
conala
|
24041436-36
|
Set multi index on columns 'Company' and 'date' of data frame `df` in pandas.
|
df.set_index(['Company', 'date'], inplace=True)
|
[
"pandas.reference.api.pandas.dataframe.set_index"
] |
VAR_STR.set_index(['VAR_STR', 'VAR_STR'], inplace=True)
|
conala
|
13277440-73
|
use upper case letters to print hex value `value`
|
print('0x%X' % value)
|
[] |
print('0x%X' % VAR_STR)
|
conala
|
34587346-8
|
Find all Chinese characters in string `ipath`
|
re.findall('[\u4e00-\u9fff]+', ipath)
|
[
"python.library.re#re.findall"
] |
re.findall('[一-\u9fff]+', VAR_STR)
|
conala
|
466345-98
|
parse string "Jun 1 2005 1:33PM" into datetime by format "%b %d %Y %I:%M%p"
|
datetime.strptime('Jun 1 2005 1:33PM', '%b %d %Y %I:%M%p')
|
[
"python.library.datetime#datetime.datetime.strptime"
] |
datetime.strptime('VAR_STR', 'VAR_STR')
|
conala
|
466345-79
|
parse string "Aug 28 1999 12:00AM" into datetime
|
parser.parse('Aug 28 1999 12:00AM')
|
[
"python.library.email.parser#email.parser.Parser.parse"
] |
parser.parse('VAR_STR')
|
conala
|
40620804-62
|
sort list `lst` with positives coming before negatives with values sorted respectively
|
sorted(lst, key=lambda x: (x < 0, x))
|
[
"python.library.functions#sorted"
] |
sorted(VAR_STR, key=lambda x: (x < 0, x))
|
conala
|
18990069-2
|
get tuples of the corresponding elements from lists `lst` and `lst2`
|
[(x, lst2[i]) for i, x in enumerate(lst)]
|
[
"python.library.functions#enumerate"
] |
[(x, VAR_STR[i]) for i, x in enumerate(VAR_STR)]
|
conala
|
18990069-9
|
create tuples containing elements that are at the same index of list `lst` and list `lst2`
|
[(i, j) for i, j in zip(lst, lst2)]
|
[
"python.library.functions#zip"
] |
[(i, j) for i, j in zip(VAR_STR, VAR_STR)]
|
conala
|
18990069-82
|
get tuples from lists `lst` and `lst2` using list comprehension in python 2
|
[(lst[i], lst2[i]) for i in range(len(lst))]
|
[
"python.library.functions#len",
"python.library.functions#range"
] |
[(VAR_STR[i], VAR_STR[i]) for i in range(len(VAR_STR))]
|
conala
|
4928526-31
|
python, format string "{} %s {}" to have 'foo' and 'bar' in the first and second positions
|
"""{} %s {}""".format('foo', 'bar')
|
[
"python.library.functions#format"
] |
"""VAR_STR""".format('VAR_STR', 'VAR_STR')
|
conala
|
10037742-54
|
replace string ' and ' in string `stuff` with character '/'
|
stuff.replace(' and ', '/')
|
[
"python.library.stdtypes#str.replace"
] |
VAR_STR.replace(' and ', 'VAR_STR')
|
conala
|
9336270-77
|
Execute SQL statement `sql` with values of dictionary `myDict` as parameters
|
cursor.execute(sql, list(myDict.values()))
|
[
"python.library.functions#list",
"python.library.sqlite3#sqlite3.Cursor.execute",
"python.library.stdtypes#dict.values"
] |
cursor.execute(VAR_STR, list(VAR_STR.values()))
|
conala
|
15882395-40
|
set the size of figure `fig` in inches to width height of `w`, `h`
|
fig.set_size_inches(w, h, forward=True)
|
[
"matplotlib.figure_api#matplotlib.figure.Figure.set_size_inches"
] |
VAR_STR.set_size_inches(VAR_STR, VAR_STR, forward=True)
|
conala
|
30062429-44
|
get value of first index of each element in list `a`
|
[x[0] for x in a]
|
[] |
[x[0] for x in VAR_STR]
|
conala
|
30062429-17
|
python how to get every first element in 2 dimensional list `a`
|
[i[0] for i in a]
|
[] |
[i[0] for i in VAR_STR]
|
conala
|
3277503-53
|
read file `fname` line by line into a list `content`
|
with open(fname) as f:
content = f.readlines()
|
[
"python.library.urllib.request#open",
"python.library.io#io.IOBase.readlines"
] |
with open(VAR_STR) as f:
VAR_STR = f.readlines()
|
conala
|
3277503-95
|
read file 'filename' line by line into a list `lines`
|
with open('filename') as f:
lines = f.readlines()
|
[
"python.library.urllib.request#open",
"python.library.io#io.IOBase.readlines"
] |
with open('VAR_STR') as f:
VAR_STR = f.readlines()
|
conala
|
3277503-68
|
read file 'filename' line by line into a list `lines`
|
lines = [line.rstrip('\n') for line in open('filename')]
|
[
"python.library.urllib.request#open",
"python.library.stdtypes#str.rstrip"
] |
VAR_STR = [line.rstrip('\n') for line in open('VAR_STR')]
|
conala
|
3277503-73
|
read file "file.txt" line by line into a list `array`
|
with open('file.txt', 'r') as ins:
array = []
for line in ins:
array.append(line)
|
[
"python.library.urllib.request#open",
"python.library.array#array.array.append"
] |
with open('VAR_STR', 'r') as ins:
VAR_STR = []
for line in ins:
VAR_STR.append(line)
|
conala
|
19794051-87
|
Remove anything in parenthesis from string `item` with a regex
|
item = re.sub(' ?\\([^)]+\\)', '', item)
|
[
"python.library.re#re.sub"
] |
VAR_STR = re.sub(' ?\\([^)]+\\)', '', VAR_STR)
|
conala
|
19794051-95
|
Remove word characters in parenthesis from string `item` with a regex
|
item = re.sub(' ?\\(\\w+\\)', '', item)
|
[
"python.library.re#re.sub"
] |
VAR_STR = re.sub(' ?\\(\\w+\\)', '', VAR_STR)
|
conala
|
19794051-37
|
Remove all data inside parenthesis in string `item`
|
item = re.sub(' \\(\\w+\\)', '', item)
|
[
"python.library.re#re.sub"
] |
VAR_STR = re.sub(' \\(\\w+\\)', '', VAR_STR)
|
conala
|
15974730-10
|
retrieve the path from a Flask request
|
request.url
|
[] |
request.url
|
conala
|
14465279-6
|
delete all values in a list `mylist`
|
del mylist[:]
|
[] |
del VAR_STR[:]
|
conala
|
38708621-19
|
calculate ratio of sparsity in a numpy array `a`
|
np.isnan(a).sum() / np.prod(a.shape)
|
[
"numpy.reference.generated.numpy.isnan",
"numpy.reference.generated.numpy.prod",
"python.library.functions#sum"
] |
np.isnan(VAR_STR).sum() / np.prod(VAR_STR.shape)
|
conala
|
12005558-73
|
get digits in string `my_string`
|
"""""".join(c for c in my_string if c.isdigit())
|
[
"python.library.stdtypes#str.isdigit",
"python.library.stdtypes#str.join"
] |
"""""".join(c for c in VAR_STR if c.isdigit())
|
conala
|
15043326-39
|
get all characters between two `$` characters in string `string`
|
re.findall('\\$([^$]*)\\$', string)
|
[
"python.library.re#re.findall"
] |
re.findall('\\$([^$]*)\\$', VAR_STR)
|
conala
|
15043326-41
|
getting the string between 2 '$' characters in '$sin (x)$ is an function of x'
|
re.findall('\\$(.*?)\\$', '$sin (x)$ is an function of x')
|
[
"python.library.re#re.findall"
] |
re.findall('\\$(.*?)\\$', 'VAR_STR')
|
conala
|
2606976-16
|
get list of string elements in string `data` delimited by commas, putting `0` in place of empty strings
|
[(int(x) if x else 0) for x in data.split(',')]
|
[
"python.library.functions#int",
"python.library.stdtypes#str.split"
] |
[(int(x) if x else 0) for x in VAR_STR.split(',')]
|
conala
|
2606976-27
|
split string `s` into a list of strings based on ',' then replace empty strings with zero
|
""",""".join(x or '0' for x in s.split(','))
|
[
"python.library.stdtypes#str.join",
"python.library.stdtypes#str.split"
] |
"""VAR_STR""".join(x or '0' for x in VAR_STR.split('VAR_STR'))
|
conala
|
41251391-88
|
get a list of the keys in each dictionary in a dictionary of dictionaries `foo`
|
[k for d in list(foo.values()) for k in d]
|
[
"python.library.functions#list",
"python.library.stdtypes#dict.values"
] |
[k for d in list(VAR_STR.values()) for k in d]
|
conala
|
35561743-31
|
count `True` values associated with key 'one' in dictionary `tadas`
|
sum(item['one'] for item in list(tadas.values()))
|
[
"python.library.functions#sum",
"python.library.functions#list",
"python.library.stdtypes#dict.values"
] |
sum(item['VAR_STR'] for item in list(VAR_STR.values()))
|
conala
|
6764909-58
|
remove all duplicate items from a list `lseperatedOrblist`
|
woduplicates = list(set(lseperatedOrblist))
|
[
"python.library.functions#list",
"python.library.stdtypes#set"
] |
woduplicates = list(set(VAR_STR))
|
conala
|
983354-40
|
prompt string 'Press Enter to continue...' to the console
|
input('Press Enter to continue...')
|
[
"python.library.functions#input"
] |
input('VAR_STR')
|
conala
|
3220284-47
|
customize the time format in python logging
|
formatter = logging.Formatter('%(asctime)s;%(levelname)s;%(message)s')
|
[] |
formatter = logging.Formatter('%(asctime)s;%(levelname)s;%(message)s')
|
conala
|
21129020-99
|
set the default encoding to 'utf-8'
|
sys.setdefaultencoding('utf8')
|
[] |
sys.setdefaultencoding('utf8')
|
conala
|
20110170-28
|
reset index of dataframe `df`so that existing index values are transferred into `df`as columns
|
df.reset_index(inplace=True)
|
[
"pandas.reference.api.pandas.dataframe.reset_index"
] |
VAR_STR.reset_index(inplace=True)
|
conala
|
1920145-91
|
Get all the keys from dictionary `y` whose value is `1`
|
[i for i in y if y[i] == 1]
|
[] |
[i for i in VAR_STR if VAR_STR[i] == 1]
|
conala
|
18142090-6
|
Sort list `li` in descending order based on the second element of each list inside list`li`
|
sorted(li, key=operator.itemgetter(1), reverse=True)
|
[
"python.library.operator#operator.itemgetter",
"python.library.functions#sorted"
] |
sorted(VAR_STR, key=operator.itemgetter(1), reverse=True)
|
conala
|
15158599-50
|
remove false entries from a dictionary `hand`
|
{k: v for k, v in list(hand.items()) if v}
|
[
"python.library.functions#list",
"python.library.stdtypes#dict.items"
] |
{k: v for k, v in list(VAR_STR.items()) if v}
|
conala
|
15158599-74
|
Get a dictionary from a dictionary `hand` where the values are present
|
dict((k, v) for k, v in hand.items() if v)
|
[
"python.library.stdtypes#dict",
"python.library.stdtypes#dict.items"
] |
dict((k, v) for k, v in VAR_STR.items() if v)
|
conala
|
34705205-97
|
sort a nested list by the inverse of element 2, then by element 1
|
sorted(l, key=lambda x: (-int(x[1]), x[0]))
|
[
"python.library.functions#sorted",
"python.library.functions#int"
] |
sorted(l, key=lambda x: (-int(x[1]), x[0]))
|
conala
|
19410018-13
|
count the number of words in a string `s`
|
len(s.split())
|
[
"python.library.functions#len",
"python.library.stdtypes#str.split"
] |
len(VAR_STR.split())
|
conala
|
1450393-15
|
read line by line from stdin
|
for line in fileinput.input():
pass
|
[
"python.library.fileinput#fileinput.input"
] |
for line in fileinput.input():
pass
|
conala
|
1450393-89
|
read line by line from stdin
|
for line in sys.stdin:
pass
|
[] |
for line in sys.stdin:
pass
|
conala
|
3673428-56
|
convert ascii value 'a' to int
|
ord('a')
|
[
"python.library.functions#ord"
] |
ord('VAR_STR')
|
conala
|
13418405-19
|
get name of primary field `name` of django model `CustomPK`
|
CustomPK._meta.pk.name
|
[] |
VAR_STR._meta.pk.VAR_STR
|
conala
|
13636592-2
|
sort a pandas data frame according to column `Peak` in ascending and `Weeks` in descending order
|
df.sort_values(['Peak', 'Weeks'], ascending=[True, False], inplace=True)
|
[
"pandas.reference.api.pandas.dataframe.sort_values"
] |
df.sort_values(['VAR_STR', 'VAR_STR'], ascending=[True, False], inplace=True)
|
conala
|
13636592-66
|
sort a pandas data frame by column `Peak` in ascending and `Weeks` in descending order
|
df.sort(['Peak', 'Weeks'], ascending=[True, False], inplace=True)
|
[
"pandas.reference.api.pandas.index.sort"
] |
df.sort(['VAR_STR', 'VAR_STR'], ascending=[True, False], inplace=True)
|
conala
|
12030179-56
|
setup a smtp mail server to `smtp.gmail.com` with port `587`
|
server = smtplib.SMTP('smtp.gmail.com', 587)
|
[
"python.library.smtplib#smtplib.SMTP"
] |
server = smtplib.SMTP('VAR_STR', 587)
|
conala
|
533398-65
|
execute external commands/script `your_own_script` with csh instead of bash
|
os.system('tcsh your_own_script')
|
[
"python.library.os#os.system"
] |
os.system('tcsh your_own_script')
|
conala
|
533398-90
|
execute command 'echo $0' in Z shell
|
os.system("zsh -c 'echo $0'")
|
[
"python.library.os#os.system"
] |
os.system("zsh -c 'echo $0'")
|
conala
|
34437284-35
|
sum of product of combinations in a list `l`
|
sum([(i * j) for i, j in list(itertools.combinations(l, 2))])
|
[
"python.library.itertools#itertools.combinations",
"python.library.functions#sum",
"python.library.functions#list"
] |
sum([(i * j) for i, j in list(itertools.combinations(VAR_STR, 2))])
|
conala
|
13781828-57
|
Truncate `\r\n` from each string in a list of string `example`
|
example = [x.replace('\r\n', '') for x in example]
|
[
"python.library.stdtypes#str.replace"
] |
VAR_STR = [x.replace('VAR_STR', '') for x in VAR_STR]
|
conala
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.