neulab/docprompting-conala huggingface dataset:
# Create list `instancelist` containing 29 objects of type MyClass
instancelist = [MyClass() for i in range(29)]
# Taking the results of a bash command "awk '{print $10, $11}' test.txt > test2.txt"
os.system("awk '{print $10, $11}' test.txt > test2.txt")
# selenium wait for driver `driver` 60 seconds before throwing a NoSuchElementExceptions exception
driver.implicitly_wait(60)
# selenium webdriver switch to frame 'frameName'
driver.switch_to_frame('frameName')
# Save plot `plt` as png file 'filename.png'
plt.savefig('filename.png')
# Save matplotlib graph to image file `filename.png` at a resolution of `300 dpi`
plt.savefig('filename.png', dpi=300)
# search for regex pattern 'Test(.*)print' in string `testStr` including new line character '\n'
re.search('Test(.*)print', testStr, re.DOTALL)
# Enclose numbers in quotes in a string `This is number 1 and this is number 22`
re.sub('(\\d+)', '"\\1"', 'This is number 1 and this is number 22')
# Importing file `file` from folder '/path/to/application/app/folder'
sys.path.insert(0, '/path/to/application/app/folder')
import file
# append the sum of each tuple pair in the grouped list `list1` and list `list2` elements to list `list3`
list3 = [(a + b) for a, b in zip(list1, list2)]
# remove the punctuation '!', '.', ':' from a string `asking`
out = ''.join(c for c in asking if c not in ('!', '.', ':'))
# use a list of values `[3,6]` to select rows from a pandas dataframe `df`'s column 'A'
df[df['A'].isin([3, 6])]
# Parse a file `sample.xml` using expat parsing in python 3
parser.ParseFile(open('sample.xml', 'rb'))
# match zero-or-more instances of lower case alphabet characters in a string `f233op `
re.findall('([a-z]*)', 'f233op')
# match zero-or-more instances of lower case alphabet characters in a string `f233op `
re.findall('([a-z])*', 'f233op')
# Convert hex string "deadbeef" to integer
int('deadbeef', 16)
# encode unicode string '\xc5\xc4\xd6' to utf-8 code
print('\xc5\xc4\xd6'.encode('UTF8'))
# solve for the least squares' solution of matrices `a` and `b`
np.linalg.solve(np.dot(a.T, a), np.dot(a.T, b))
# create a file 'filename' with each tuple in the list `mylist` written to a line
open('filename', 'w').write('\n'.join('%s %s' % x for x in mylist))
# print numbers in list `list` with precision of 3 decimal places
print('[%s]' % ', '.join('%.3f' % val for val in list))
# format print output of list of floats `l` to print only up to 3 decimal points
print('[' + ', '.join('%5.3f' % v for v in l) + ']')
# print a list of floating numbers `l` using string formatting
print([('%5.3f' % val) for val in l])
# delete letters from string '12454v'
"""""".join(filter(str.isdigit, '12454v'))
# Get a md5 hash from string `thecakeisalie`
k = hashlib.md5('thecakeisalie').hexdigest()
# replace string 'in.' with ' in. ' in dataframe `df` column 'a'
df['a'] = df['a'].str.replace('in.', ' in. ')
# convert string `x'  to dictionary splitted by `=` using list comprehension
dict([x.split('=') for x in s.split()])
# add a column 'new_col' to dataframe `df` for index in range
df['new_col'] = list(range(1, len(df) + 1))
# apply logical operator 'AND' to all elements in list `a_list`
all(a_list)
# get a list of booleans `z` that shows wether the corresponding items in list `x` and `y` are equal
z = [(i == j) for i, j in zip(x, y)]
# create a list which indicates whether each element in `x` and `y` is identical
[(x[i] == y[i]) for i in range(len(x))]
# convert currency string `dollars` to decimal `cents_int`
cents_int = int(round(float(dollars.strip('$')) * 100))
# sort list `users` using values associated with key 'id' according to elements in list `order`
users.sort(key=lambda x: order.index(x['id']))
# sort a python list of dictionaries `users` by a given list `order` of ids 'id' with the desired order
users.sort(key=lambda x: order.index(x['id']))
# Get all indexes of a letter `e` from a string `word`
[index for index, letter in enumerate(word) if letter == 'e']
# format parameters 'b' and 'a' into plcaeholders in string "{0}\\w{{2}}b{1}\\w{{2}}quarter"
"""{0}\\w{{2}}b{1}\\w{{2}}quarter""".format('b', 'a')
# get line count of file 'myfile.txt'
sum((1 for line in open('myfile.txt')))
# get line count of file `filename`
def bufcount(filename):
    f = open(filename)
    lines = 0
    buf_size = (1024 * 1024)
    read_f = f.read
    buf = read_f(buf_size)
    while buf:
        lines += buf.count('\n')
        buf = read_f(buf_size)
    return lines
# Determine the byte length of a utf-8 encoded string `s`
return len(s.encode('utf-8'))
# specify multiple positional arguments with argparse
parser.add_argument('input', nargs='+')
# delete every 8th column in a numpy array 'a'.
np.delete(a, list(range(0, a.shape[1], 8)), axis=1)
# Replace repeated instances of a character '*' with a single instance in a string 'text'
re.sub('\\*\\*+', '*', text)
# replace repeated instances of "*" with a single instance of "*"
re.sub('\\*+', '*', text)
# split elements of a list `l` by '\t'
[i.partition('\t')[-1] for i in l if '\t' in i]
# get two random records from model 'MyModel' in Django
MyModel.objects.order_by('?')[:2]
# get value of first child of xml node `name`
name[0].firstChild.nodeValue
# Convert a hex string `437c2123 ` according to ascii value.
"""437c2123""".decode('hex')
# Get all `a` tags where the text starts with value `some text` using regex
doc.xpath("//a[starts-with(text(),'some text')]")
# split string `str1` on one or more spaces with a regular expression
re.split(' +', str1)
# python split string based on regular expression
re.findall('\\S+', str1)
# BeautifulSoup find all tags with attribute 'name' equal to 'description'
soup.findAll(attrs={'name': 'description'})
# get the dot product of two one dimensional numpy arrays
np.dot(a[:, (None)], b[(None), :])
# multiplication of two 1-dimensional arrays  in numpy
np.outer(a, b)
# insert a list `k` at the front of list `a`
a.insert(0, k)
# insert elements of list `k` into list `a` at position `n`
a = a[:n] + k + a[n:]
# get values from a dictionary `my_dict` whose key contains the string `Date`
[v for k, v in list(my_dict.items()) if 'Date' in k]
# Print variable `count` and variable `conv` with space string '    ' in between
print(str(count) + '    ' + str(conv))
# convert JSON string '2012-05-29T19:30:03.283Z' into a DateTime object using format '%Y-%m-%dT%H:%M:%S.%fZ'
datetime.datetime.strptime('2012-05-29T19:30:03.283Z', '%Y-%m-%dT%H:%M:%S.%fZ')
# decode string `content` to UTF-8 code
print(content.decode('utf8'))
# convert list `data` into a string of its elements
print(''.join(map(str, data)))
# sort list `lst` in descending order based on the second item of each tuple in it
lst.sort(key=lambda x: x[2], reverse=True)
# Replace non-ASCII characters in string `text` with a single space
re.sub('[^\\x00-\\x7F]+', ' ', text)
# get all digits in a string `s` after a '[' character
re.findall('\\d+(?=[^[]+$)', s)
# create a list of tuples which contains number 9 and the number before it, for each occurrence of 9 in the list 'myList'
[(x, y) for x, y in zip(myList, myList[1:]) if y == 9]
# remove all instances of [1, 1] from list `a`
a[:] = [x for x in a if x != [1, 1]]
# remove all instances of `[1, 1]` from a list `a`
[x for x in a if x != [1, 1]]
# Convert nested list `x` into a flat list
[j for i in x for j in i]
# get each value from a list of lists `a` using itertools
print(list(itertools.chain.from_iterable(a)))
# get the indices of tuples in list of tuples `L` where the first value is 53
[i for i, v in enumerate(L) if v[0] == 53]
# convert string '2011221' into a DateTime object using format '%Y%W%w'
datetime.strptime('2011221', '%Y%W%w')
# Create a dictionary from string `e` separated by `-` and `,`
dict((k, int(v)) for k, v in (e.split(' - ') for e in s.split(',')))
# insert directory './path/to/your/modules/' to current directory
sys.path.insert(0, './path/to/your/modules/')
# Sort a list of strings 'words' such that items starting with 's' come first.
sorted(words, key=lambda x: 'a' + x if x.startswith('s') else 'b' + x)
# execute a mv command `mv /home/somedir/subdir/* somedir/` in subprocess
subprocess.call('mv /home/somedir/subdir/* somedir/', shell=True)
# How to use the mv command in Python with subprocess
subprocess.call('mv /home/somedir/subdir/* somedir/', shell=True)
# use regex pattern '^12(?=.{4}$)' to remove digit 12 if followed by 4 other digits in column `c_contofficeID` of dataframe `df`
df.c_contofficeID.str.replace('^12(?=.{4}$)', '')
# find all digits between two characters `\xab` and `\xbb`in a string `text`
print(re.findall('\\d+', '\n'.join(re.findall('\xab([\\s\\S]*?)\xbb', text))))
# convert utf-8 with bom string `s` to utf-8 with no bom `u`
u = s.decode('utf-8-sig')
# convert unicode string '\xd0\xbc\xd0\xb0\xd1\x80\xd0\xba\xd0\xb0' to byte string
'\xd0\xbc\xd0\xb0\xd1\x80\xd0\xba\xd0\xb0'.encode('latin-1')
# get a list of items from the list `some_list` that contain string 'abc'
matching = [s for s in some_list if 'abc' in s]
# swap each pair of characters in string `s`
"""""".join([s[x:x + 2][::-1] for x in range(0, len(s), 2)])
# django return a QuerySet list containing the values of field 'eng_name' in model `Employees`
Employees.objects.values_list('eng_name', flat=True)
# sum elements at the same index of each list in list `lists`
map(sum, zip(*lists))
# writing items in list `thelist` to file `thefile`
for item in thelist:
    thefile.write(('%s\n' % item))
# writing items in list `thelist` to file `thefile`
for item in thelist:
    pass
# serialize `itemlist` to file `outfile`
pickle.dump(itemlist, outfile)
# writing items in list `itemlist` to file `outfile`
outfile.write('\n'.join(itemlist))
# replace all the nan values with 0 in a pandas dataframe `df`
df.fillna(0)
# convert a 1d `A` array to a 2d array `B`
B = np.reshape(A, (-1, 2))
# a sequence of empty lists of length `n`
[[] for _ in range(n)]
# update a list `l1` dictionaries with a key `count` and value from list `l2`
[dict(d, count=n) for d, n in zip(l1, l2)]
# merge rows from dataframe `df1` with rows from dataframe `df2` and calculate the mean for rows that have the same value of axis 1
pd.concat((df1, df2), axis=1).mean(axis=1)
# remove the element in list `a` at index `index`
a.pop(index)
# sort a dictionary `d` by length of its values and print as string
print(' '.join(sorted(d, key=lambda k: len(d[k]), reverse=True)))
# Replace comma with dot in a string `original_string` using regex
new_string = re.sub('"(\\d+),(\\d+)"', '\\1.\\2', original_string)
# plot data of column 'index' versus column 'A' of dataframe `monthly_mean` after resetting its index
monthly_mean.reset_index().plot(x='index', y='A')
# set environment variable 'DEBUSSY' equal to 1
os.environ['DEBUSSY'] = '1'
# Get a environment variable `DEBUSSY`
print(os.environ['DEBUSSY'])
# set environment variable 'DEBUSSY' to '1'
os.environ['DEBUSSY'] = '1'
# convert pandas group by object to multi-indexed dataframe with indices 'Name' and 'Destination'
df.set_index(['Name', 'Destination'])
# decode unicode string `s` into a readable unicode literal
s.decode('unicode_escape')
# get a random key `country` and value `capital` form a dictionary `d`
country, capital = random.choice(list(d.items()))
# zip file `pdffile` using its basename as directory name
archive.write(pdffile, os.path.basename(pdffile))
# call bash command 'tar c my_dir | md5sum' with pipe
subprocess.call('tar c my_dir | md5sum', shell=True)
# trim whitespace (including tabs) in `s` on the left side
s = s.lstrip()
# trim whitespace (including tabs) in `s` on the right side
s = s.rstrip()
# trim characters ' \t\n\r' in `s`
s = s.strip(' \t\n\r')
# trim whitespaces (including tabs) in string `s`
print(re.sub('[\\s+]', '', s))
# set color marker styles `--bo` in matplotlib
plt.plot(list(range(10)), '--bo')
# set circle markers on plot for individual points  defined in list   `[1,2,3,4,5,6,7,8,9,10]` created by range(10)
plt.plot(list(range(10)), linestyle='--', marker='o', color='b')
# sort list `results` by keys value 'year'
sorted(results, key=itemgetter('year'))
# sort array `arr` in ascending order by values of the 3rd column
arr[arr[:, (2)].argsort()]
# sort rows of numpy matrix `arr` in ascending order according to all column values
numpy.sort(arr, axis=0)
# Format a string `u'Andr\xc3\xa9'` that has unicode characters
"""""".join(chr(ord(c)) for c in 'Andr\xc3\xa9')
# convert a unicode 'Andr\xc3\xa9' to a string
"""""".join(chr(ord(c)) for c in 'Andr\xc3\xa9').decode('utf8')
# remove white spaces from the end of string "    xyz     "
"""    xyz     """.rstrip()
# Convert string '03:55' into datetime.time object
datetime.datetime.strptime('03:55', '%H:%M').time()
# generate all possible string permutations of each two elements in list `['hel', 'lo', 'bye']`
print([''.join(a) for a in combinations(['hel', 'lo', 'bye'], 2)])
# print a list of integers `list_of_ints` using string formatting
print(', '.join(str(x) for x in list_of_ints))
# un-escaping characters in a string with python
"""\\u003Cp\\u003E""".decode('unicode-escape')
# save current figure to file 'graph.png' with resolution of 1000 dpi
plt.savefig('graph.png', dpi=1000)
# Print a emoji from a string `\\ud83d\\ude4f` having surrogate pairs
"""\\ud83d\\ude4f""".encode('utf-16', 'surrogatepass').decode('utf-16')
# apply two different aggregating functions `mean` and `sum` to the same column `dummy` in pandas data frame `df`
df.groupby('dummy').agg({'returns': [np.mean, np.sum]})
# map two lists `keys` and `values` into a dictionary
new_dict = {k: v for k, v in zip(keys, values)}
# map two lists `keys` and `values` into a dictionary
dict((k, v) for k, v in zip(keys, values))
# map two lists `keys` and `values` into a dictionary
dict([(k, v) for k, v in zip(keys, values)])
# get a list of substrings consisting of the first 5 characters of every string in list `buckets`
[s[:5] for s in buckets]
# Rearrange the columns 'a','b','x','y' of pandas DataFrame `df` in mentioned sequence 'x' ,'y','a' ,'b'
df = df[['x', 'y', 'a', 'b']]
# Get a list of all fields in class `User` that are marked `required`
[k for k, v in User._fields.items() if v.required]
# create a dictionary `{'spam': 5, 'ham': 6}` into another dictionary `d` field 'dict3'
d['dict3'] = {'spam': 5, 'ham': 6}
# Get rank of rows from highest to lowest of dataframe `df`, grouped by value in column `group`, according to value in column `value`
df.groupby('group')['value'].rank(ascending=False)
# remove column by index `[:, 0:2]` in dataframe `df`
df = df.ix[:, 0:2]
# convert a list of hex byte strings `['BB', 'A7', 'F6', '9E']` to a list of hex integers
[int(x, 16) for x in ['BB', 'A7', 'F6', '9E']]
# convert the elements of list `L` from hex byte strings to hex integers
[int(x, 16) for x in L]
# Create a dictionary `d` from list `iterable`
d = dict(((key, value) for (key, value) in iterable))
# Create a dictionary `d` from list `iterable`
d = {key: value for (key, value) in iterable}
# Create a dictionary `d` from list of key value pairs `iterable`
d = {k: v for (k, v) in iterable}
# drop a single subcolumn 'a' in column 'col1' from a dataframe `df`
df.drop(('col1', 'a'), axis=1)
# dropping all columns named 'a' from a multiindex 'df', across all level.
df.drop('a', level=1, axis=1)
# return list `result` of sum of elements of each list `b` in list of lists `a`
result = [sum(b) for b in a]
# make a line plot with errorbars, `ebar`, from data `x, y, err` and set color of the errorbars to `y` (yellow)
ebar = plt.errorbar(x, y, yerr=err, ecolor='y')
# open a file `/home/user/test/wsservice/data.pkl` in binary write mode
output = open('/home/user/test/wsservice/data.pkl', 'wb')
# compare two lists in python `a` and `b` and return matches
set(a).intersection(b)
# How can I compare two lists in python and return matches
[i for i, j in zip(a, b) if i == j]
# sort a dictionary `a` by values that are list type
t = sorted(list(a.items()), key=lambda x: x[1])
# Replace all non-alphanumeric characters in a string
re.sub('[^0-9a-zA-Z]+', '*', 'h^&ell`.,|o w]{+orld')
# find all possible sequences of elements in a list `[2, 3, 4]`
map(list, permutations([2, 3, 4]))
# create a list by appending components from list `a` and reversed list `b` interchangeably
[value for pair in zip(a, b[::-1]) for value in pair]
# get http header of the key 'your-header-name' in flask
request.headers['your-header-name']
# Create list `listy` containing 3 empty lists
listy = [[] for i in range(3)]
# convert datetime.date `dt` to utc timestamp
timestamp = (dt - datetime(1970, 1, 1)).total_seconds()
# find float number proceeding sub-string `par` in string `dir`
float(re.findall('(?:^|_)' + par + '(\\d+\\.\\d*)', dir)[0])
# Get all the matches from a string `abcd` if it begins with a character `a`
re.findall('[^a]', 'abcd')
# get a relative path of file 'my_file' into variable `fn`
fn = os.path.join(os.path.dirname(__file__), 'my_file')
# Can I sort text by its numeric value in Python?
sorted(list(mydict.items()), key=lambda a: map(int, a[0].split('.')))
# execute python code `myscript.py` in a virtualenv `/path/to/my/venv` from matlab
system('/path/to/my/venv/bin/python myscript.py')
# remove dictionary from list `a` if the value associated with its key 'link' is in list `b`
a = [x for x in a if x['link'] not in b]
# Convert a string of numbers `example_string` separated by `,` into a list of integers
map(int, example_string.split(','))
# Convert a string of numbers 'example_string' separated by comma into a list of numbers
[int(s) for s in example_string.split(',')]
# remove newlines and whitespace from string `yourstring`
re.sub('[\\ \\n]{2,}', '', yourstring)
# Get a list of pairs of key-value sorted by values in dictionary `data`
sorted(list(data.items()), key=lambda x: x[1])
# sort dict by value python
sorted(list(data.items()), key=lambda x: x[1])
# update all values associated with key `i` to string 'updated' if value `j` is not equal to 'None' in dictionary `d`
{i: 'updated' for i, j in list(d.items()) if j != 'None'}
# Filter a dictionary `d` to remove keys with value None and replace other values with 'updated'
dict((k, 'updated') for k, v in d.items() if v is None)
# Filter a dictionary `d` to remove keys with value 'None' and replace other values with 'updated'
dict((k, 'updated') for k, v in d.items() if v != 'None')
# create a list `listofzeros` of `n` zeros
listofzeros = [0] * n
# sort a list `s` by first and second attributes
s = sorted(s, key=lambda x: (x[1], x[2]))
# sort a list of lists `s` by second and third element in each list.
s.sort(key=operator.itemgetter(1, 2))
# sort dictionary of lists `myDict` by the third item in each list
sorted(list(myDict.items()), key=lambda e: e[1][2])
# get the first element of each tuple in a list `rows`
[x[0] for x in rows]
# get a list `res_list` of the first elements of each tuple in a list of tuples `rows`
res_list = [x[0] for x in rows]
# append the first element of array `a` to array `a`
numpy.append(a, a[0])
# reset index of series `s`
s.reset_index(0).reset_index(drop=True)
# open a file 'bundled-resource.jpg' in the same directory as a python script
f = open(os.path.join(__location__, 'bundled-resource.jpg'))
# Set value for key `a` in dict `count` to `0` if key `a` does not exist or if value is `none`
count.setdefault('a', 0)
# serialise SqlAlchemy RowProxy object `row` to a json object
json.dumps([dict(list(row.items())) for row in rs])
# check if dictionary `L[0].f.items()` is in dictionary `a3.f.items()`
set(L[0].f.items()).issubset(set(a3.f.items()))
# convert a python dictionary `d` to a list of tuples
[(v, k) for k, v in list(d.items())]
# convert dictionary of pairs `d` to a list of tuples
[(v, k) for k, v in d.items()]
# convert python 2 dictionary `a` to a list of tuples where the value is the first tuple element and the key is the second tuple element
[(v, k) for k, v in a.items()]
# convert a python dictionary 'a' to a list of tuples
[(k, v) for k, v in a.items()]
# split list `l` into `n` sized lists
[l[i:i + n] for i in range(0, len(l), n)]
# split a list `l` into evenly sized chunks `n`
[l[i:i + n] for i in range(0, len(l), n)]
# print 'here is your checkmark: ' plus unicode character u'\u2713'
print('here is your checkmark: ' + '\u2713')
# print unicode characters in a string `\u0420\u043e\u0441\u0441\u0438\u044f`
print('\u0420\u043e\u0441\u0441\u0438\u044f')
# Initialize a list of empty lists `a` of size 3
a = [[] for i in range(3)]
# 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]
# get everything after last slash in a url stored in variable 'url'
url.rsplit('/', 1)[-1]
# 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])
# 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]
# convert a list of dictionaries `listofdict into a dictionary of dictionaries
dict((d['name'], d) for d in listofdict)
# sort a list `unsorted_list` based on another sorted list `presorted_list`
sorted(unsorted_list, key=presorted_list.index)
# 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)]
# convert dictionary `dict` into a flat list
print([y for x in list(dict.items()) for y in x])
# 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]
# split a string 's' by space while ignoring spaces within square braces and quotes.
re.findall('\\[[^\\]]*\\]|"[^"]*"|\\S+', s)
# Sort dictionary `x` by value in ascending order
sorted(list(x.items()), key=operator.itemgetter(1))
# Sort dictionary `dict1` by value in ascending order
sorted(dict1, key=dict1.get)
# Sort dictionary `d` by value in descending order
sorted(d, key=d.get, reverse=True)
# Sort dictionary `d` by value in ascending order
sorted(list(d.items()), key=(lambda x: x[1]))
# get the size of a list `[1,2,3]`
len([1, 2, 3])
# 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))
# django create a foreign key column `user` and link it to table 'User'
user = models.ForeignKey('User', unique=True)
# write a list of strings `row` to csv object `csvwriter`
csvwriter.writerow(row)
# pass dictionary items `data` as keyword arguments in function `my_function`
my_function(**data)
# merge the elements in a list `lst` sequentially
[''.join(seq) for seq in zip(lst, lst[1:])]
# switch keys and values in a dictionary `my_dict`
dict((v, k) for k, v in my_dict.items())
# regular expression for validating string 'user' containing a sequence of characters ending with '-' followed by any number of digits.
re.compile('{}-\\d*'.format(user))
# 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))]
# convert `ms` milliseconds to a datetime object
datetime.datetime.fromtimestamp(ms / 1000.0)
# change a string of integers `x` separated by spaces to a list of int
x = map(int, x.split())
# convert a string of integers `x` separated by spaces to a list of integers
x = [int(i) for i in x.split()]
# subprocess run command 'start command -flags arguments' through the shell
subprocess.call('start command -flags arguments', shell=True)
# run command 'command -flags arguments &' on command line tools as separate processes
subprocess.call('command -flags arguments &', shell=True)
# regex matching 5-digit substrings not enclosed with digits in `s`
re.findall('(?<!\\d)\\d{5}(?!\\d)', s)
# convert a list of strings `['1', '-1', '1']` to a list of numbers
map(int, ['1', '-1', '1'])
# concatenate items from list `parts` into a string starting from the second element
"""""".join(parts[1:])
# insert a character ',' into a string in front of '+' character in second part of the string
""",+""".join(c.rsplit('+', 1))
# Use multiple groupby and agg operations `sum`, `count`, `std` for pandas data frame `df`
df.groupby(level=0).agg(['sum', 'count', 'std'])
# output data of the first 7 columns of Pandas dataframe
pandas.set_option('display.max_columns', 7)