neulab/docprompting-conala huggingface dataset:
# sort a pandas data frame by column `Peak` in ascending and `Weeks` in descending order
df.sort(['Peak', 'Weeks'], ascending=[True, False], inplace=True)
# setup a smtp mail server to `smtp.gmail.com` with port `587`
server = smtplib.SMTP('smtp.gmail.com', 587)
# execute external commands/script `your_own_script` with csh instead of bash
os.system('tcsh your_own_script')
# execute command 'echo $0' in Z shell
os.system("zsh -c 'echo $0'")
# sum of product of combinations in a list `l`
sum([(i * j) for i, j in list(itertools.combinations(l, 2))])
# Truncate `\r\n` from each string in a list of string `example`
example = [x.replace('\r\n', '') for x in example]
# right align string `mystring` with a width of 7
"""{:>7s}""".format(mystring)
# creating a numpy array of 3d coordinates from three 1d arrays `x_p`, `y_p` and `z_p`
np.vstack(np.meshgrid(x_p, y_p, z_p)).reshape(3, -1).T
# move last item of array `a` to the first position
a[-1:] + a[:-1]
# Sum of sums of each list, in a list of lists named 'lists'.
sum(sum(x) for x in lists)
# Set a window size to `1400, 1000` using selenium webdriver
driver.set_window_size(1400, 1000)
# change the case of the first letter in string `s`
return s[0].upper() + s[1:]
# get the sum of the products of each pair of corresponding elements in lists `a` and `b`
sum(x * y for x, y in zip(a, b))
# sum the products of each two elements at the same index of list `a` and list `b`
list(x * y for x, y in list(zip(a, b)))
# sum the product of each two items at the same index of list `a` and list `b`
sum(i * j for i, j in zip(a, b))
# sum the product of elements of two lists named `a` and `b`
sum(x * y for x, y in list(zip(a, b)))
# Split string `Hello` into a string of letters seperated by `,`
""",""".join('Hello')
# Matplotlib change marker size to 500
scatter(x, y, s=500, color='green', marker='h')
# change the state of the Tkinter `Text` widget to read only i.e. `disabled`
text.config(state=DISABLED)
# display attribute `attr` for each object `obj` in list `my_list_of_objs`
print([obj.attr for obj in my_list_of_objs])
# lookup dictionary key `key1` in Django template `json`
{{json.key1}}
# Sum elements of tuple `b` to their respective elements of each tuple in list `a`
c = [[(i + j) for i, j in zip(e, b)] for e in a]
# replace the last occurence of an expression '</div>' with '</bad>' in a string `s`
re.sub('(.*)</div>', '\\1</bad>', s)
# delete column 'column_name' from dataframe `df`
df = df.drop('column_name', 1)
# delete 1st, 2nd and 4th columns from dataframe `df`
df.drop(df.columns[[0, 1, 3]], axis=1)
# delete a column `column_name` without having to reassign from pandas data frame `df`
df.drop('column_name', axis=1, inplace=True)
# Sort a data `a` in descending order based on the `modified` attribute of elements using lambda function
a = sorted(a, key=lambda x: x.modified, reverse=True)
# create a dictionary `list_dict` containing each tuple in list `tuple_list` as values and the tuple's first element as the corresponding key
list_dict = {t[0]: t for t in tuple_list}
# print list `t` into a table-like shape
print('\n'.join('  '.join(map(str, row)) for row in t))
# factorize all string values in dataframe `s` into floats
(s.factorize()[0] + 1).astype('float')
# find out the number of non-matched elements at the same index of list `a` and list `b`
sum(1 for i, j in zip(a, b) if i != j)
# Get all the second values from a list of lists `A`
[row[1] for row in A]
# extract first column from a multi-dimensional array `a`
[row[0] for row in a]
# print a celsius symbol on x axis of a plot `ax`
ax.set_xlabel('Temperature (\u2103)')
# Print a celsius symbol with matplotlib
ax.set_xlabel('Temperature ($^\\circ$C)')
# Convert list of dictionaries `L` into a flat dictionary
dict(pair for d in L for pair in list(d.items()))
# merge a list of dictionaries in list `L` into a single dict
{k: v for d in L for k, v in list(d.items())}
# compile Visual Studio project `project.sln` from the command line through python
os.system('msbuild project.sln /p:Configuration=Debug')
# read lines from a csv file `./urls-eu.csv` into a list of lists `arr`
arr = [line.split(',') for line in open('./urls-eu.csv')]
# replace occurrences of two whitespaces or more with one whitespace ' ' in string `s`
re.sub(' +', ' ', s)
# count the number of rows with missing values in a pandas dataframe `df`
sum(df.apply(lambda x: sum(x.isnull().values), axis=1) > 0)
# Clicking a link using selenium using python
driver.find_element_by_xpath('xpath').click()
# convert a string literal `s` with values `\\` to raw string literal
s = s.replace('\\', '\\\\')
# get multiple integer values from a string 'string1'
map(int, re.findall('\\d+', string1))
# sort list `l` based on its elements' digits
sorted(l, key=lambda x: int(re.search('\\d+', x).group(0)))
# get first element of each tuple in list `A`
[tup[0] for tup in A]
# Write a comment `# Data for Class A\n` to a file object `f`
f.write('# Data for Class A\n')
# Find the greatest number in set `(1, 2, 3)`
print(max(1, 2, 3))
# split string 'Words, words, words.' on punctuation
re.split('\\W+', 'Words, words, words.')
# flatten a tuple `l`
[(a, b, c) for a, (b, c) in l]
# replace value '-' in any column of pandas dataframe to "NaN"
df.replace('-', 'NaN')
# Generate a random integer between 0 and 9
randint(0, 9)
# Generate a random integer between `a` and `b`
random.randint(a, b)
# Generate random integers between 0 and 9
print((random.randint(0, 9)))
# get an element at index `[1,1]`in a numpy array `arr`
print(arr[1, 1])
# call `doSomething()` in a try-except without handling the exception
try:
    doSomething()
except:
    pass
# call `doSomething()` in a try-except without handling the exception
try:
    doSomething()
except Exception:
    pass
# Create a list containing words that contain vowel letter followed by the same vowel in file 'file.text'
[w for w in open('file.txt') if not re.search('[aeiou]{2}', w)]
# print a rational number `3/2`
print('\n\x1b[4m' + '3' + '\x1b[0m' + '\n2')
# append a list [8, 7] to list `foo`
foo.append([8, 7])
# insert 77 to index 2 of list `x`
x.insert(2, 77)
# apply a list of functions named 'functions' over a list of values named 'values'
[x(y) for x, y in zip(functions, values)]
# reading tab-delimited csv file `filename` with pandas on mac
pandas.read_csv(filename, sep='\t', lineterminator='\r')
# add multiple columns `hour`, `weekday`, `weeknum` to pandas data frame `df` from lambda function `lambdafunc`
df[['hour', 'weekday', 'weeknum']] = df.apply(lambdafunc, axis=1)
# Check if key 'key1' in `dict`
('key1' in dict)
# Check if a given key 'key1' exists in dictionary `dict`
if ('key1' in dict):
    pass
# Check if a given key `key` exists in dictionary `d`
if (key in d):
    pass
# remove multiple spaces in a string `foo`
""" """.join(foo.split())
# convert tuple `tst` to string `tst2`
tst2 = str(tst)
# Get the position of a regex match for word `is` in a string `String`
re.search('\\bis\\b', String).start()
# Get the position of a regex match `is` in a string `String`
re.search('is', String).start()
# check if 3 is inside list `[1, 2, 3]`
3 in [1, 2, 3]
# get items from list `a` that don't appear in list `b`
[y for y in a if y not in b]
# identify duplicated rows in columns 'PplNum' and 'RoomNum' with additional column in dataframe `df`
df.groupby(['PplNum', 'RoomNum']).cumcount() + 1
# Jinja join elements of array `tags` with space string ' '
{{tags | join(' ')}}
# django urlsafe base64 decode string `uenc` with decryption
base64.urlsafe_b64decode(uenc.encode('ascii'))
# copy list `old_list` as `new_list`
new_list = old_list[:]
# copy list `old_list` as `new_list`
new_list = list(old_list)
# copy list `old_list` as `new_list`
new_list = copy.copy(old_list)
# deep copy list `old_list` as `new_list`
new_list = copy.deepcopy(old_list)
# make a copy of list `old_list`
[i for i in old_list]
# generate unique equal hash for equal dictionaries `a` and `b`
hash(pformat(a)) == hash(pformat(b))
# Get a list of strings `split_text` with fixed chunk size `n` from a string `the_list`
split_list = [the_list[i:i + n] for i in range(0, len(the_list), n)]
# sum of squares values in a list `l`
sum(i * i for i in l)
# calculate the sum of the squares of each value in list `l`
sum(map(lambda x: x * x, l))
# get a list each value `i` in the implicit tuple `range(3)`
list(i for i in range(3))
# revers correlating bits of integer `n`
int('{:08b}'.format(n)[::-1], 2)
# Filter Django objects by `author` with ids `1` and `2`
Book.objects.filter(author__id=1).filter(author__id=2)
# Write a regex statement to match 'lol' to 'lolllll'.
re.sub('l+', 'l', 'lollll')
# printing numbers rounding up to third decimal place
print('%.3f' % 3.1415)
# Plot using the color code `#112233` in matplotlib pyplot
pyplot.plot(x, y, color='#112233')
# remove 20 symbols in front of '.' in string 'unique12345678901234567890.mkv'
re.sub('.{20}(.mkv)', '\\1', 'unique12345678901234567890.mkv')
# check if any element of list `substring_list` are in string `string`
any(substring in string for substring in substring_list)
# convert list `myintegers` into a unicode string
"""""".join(chr(i) for i in myintegers)
# Make function `WRITEFUNCTION` output nothing in curl `p`
p.setopt(pycurl.WRITEFUNCTION, lambda x: None)
# split a string `s` at line breaks `\r\n`
[map(int, x.split('\t')) for x in s.rstrip().split('\r\n')]
# binarize the values in columns of list `order` in a pandas data frame
pd.concat([df, pd.get_dummies(df, '', '').astype(int)], axis=1)[order]
# Parse string '21/11/06 16:30' according to format '%d/%m/%y %H:%M'
datetime.strptime('21/11/06 16:30', '%d/%m/%y %H:%M')
# Get the value with the maximum length in each column in array `foo`
[max(len(str(x)) for x in line) for line in zip(*foo)]
# finding words in string `s` after keyword 'name'
re.search('name (.*)', s)
# set data in column 'value' of dataframe `df` equal to first element of each list
df['value'] = df['value'].str[0]
# get element at index 0 of each list in column 'value' of dataframe `df`
df['value'] = df['value'].str.get(0)
# remove square bracket '[]' from pandas dataframe `df` column 'value'
df['value'] = df['value'].str.strip('[]')
# Get a list from two strings `12345` and `ab` with values as each character concatenated
[(x + y) for x in '12345' for y in 'ab']
# sort keys of dictionary 'd' based on their values
sorted(d, key=lambda k: d[k][1])
# sort list `student_tuples` by second element of each tuple in ascending and third element of each tuple in descending
print(sorted(student_tuples, key=lambda t: (-t[2], t[0])))
# convert a list of lists `list_of_lists` into a list of strings keeping empty sub-lists as empty string ''
[''.join(l) for l in list_of_lists]
# sort objects in `Articles` in descending order of counts of `likes`
Article.objects.annotate(like_count=Count('likes')).order_by('-like_count')
# divide each element in list `myList` by integer `myInt`
myList[:] = [(x / myInt) for x in myList]
# format string with dict `{'5': 'you'}` with integer keys
'hello there %(5)s' % {'5': 'you'}
# Check if all elements in list `lst` are tupples of long and int
all(isinstance(x, int) for x in lst)
# check if all elements in a list 'lst' are the same type 'int'
all(isinstance(x, int) for x in lst)
# sort a dictionary `y` by value then by key
sorted(list(y.items()), key=lambda x: (x[1], x[0]), reverse=True)
# get mean of columns `2, 5, 6, 7, 8` for all rows in dataframe `df`
df.iloc[:, ([2, 5, 6, 7, 8])].mean(axis=1)
# Create a key `key` if it does not exist in dict `dic` and append element `value` to value.
dic.setdefault(key, []).append(value)
# Convert each list in list `main_list` into a tuple
map(list, zip(*main_list))
# print list of items `myList`
print('\n'.join(str(p) for p in myList))
# stack two dataframes next to each other in pandas
pd.concat([GOOG, AAPL], keys=['GOOG', 'AAPL'], axis=1)
# add dictionary `{'class': {'section': 5}}` to key 'Test' of dictionary `dic`
dic['Test'].update({'class': {'section': 5}})
# replace everything that is not an alphabet or a digit with '' in 's'.
re.sub('[\\W_]+', '', s)
# set size of `figure` to landscape A4 i.e. `11.69, 8.27` inches
figure(figsize=(11.69, 8.27))
# django jinja slice list `mylist` by '3:8'
{{(mylist | slice): '3:8'}}
# replace character 'a' with character 'e' and character 's' with character '3' in file `contents`
newcontents = contents.replace('a', 'e').replace('s', '3')
# unpack keys and values of a dictionary `d` into two lists
keys, values = zip(*list(d.items()))
# Sort a list 'lst' in descending order.
sorted(lst, reverse=True)
# Get the dot product of matrix `[1,0,0,1,0,0]` and matrix `[[0,1],[1,1],[1,0],[1,0],[1,1],[0,1]]`
np.dot([1, 0, 0, 1, 0, 0], [[0, 1], [1, 1], [1, 0], [1, 0], [1, 1], [0, 1]])
# get a random item from list `choices`
random_choice = random.choice(choices)
# apply jinja2 filters `forceescape` and `linebreaks` on variable `my_variable`
{{my_variable | forceescape | linebreaks}}
# parse string `s` to int when string contains a number
int(''.join(c for c in s if c.isdigit()))
# check if any elements in one list `list1` are in another list `list2`
len(set(list1).intersection(list2)) > 0
# Insert records in bulk from "table1" of "master" DB to "table1" of  sqlite3 `cursor` object
cursor.execute('INSERT OR REPLACE INTO master.table1 SELECT * FROM table1')
# check if string `str` is palindrome
str(n) == str(n)[::-1]
# Remove duplicates elements from list `sequences` and sort it in ascending order
sorted(set(itertools.chain.from_iterable(sequences)))
# decode utf-8 code `x` into a raw unicode literal
print(str(x).decode('raw_unicode_escape'))
# Compare if each value in list `a` is less than respective index value in list `b`
all(i < j for i, j in zip(a, b))
# create a list containing keys of dictionary `d` and sort it alphabetically
sorted(d, key=d.get)
# extend dictionary `a` with key/value pairs of dictionary `b`
a.update(b)
# Delete character "M" from a string `s` using python
s = s.replace('M', '')
# How to delete a character from a string using python?
newstr = oldstr.replace('M', '')
# save xlsxwriter file in 'app/smth1/smth2/Expenses01.xlsx' path and assign to variable `workbook`
workbook = xlsxwriter.Workbook('app/smth1/smth2/Expenses01.xlsx')
# save xlsxwriter file to 'C:/Users/Steven/Documents/demo.xlsx' path
workbook = xlsxwriter.Workbook('C:/Users/Steven/Documents/demo.xlsx')
# creating a 5x6 matrix filled with `None` and save it as `x`
x = [[None for _ in range(5)] for _ in range(6)]
# insert ' ' between every three digit before '.' and replace ',' with '.' in 12345678.46
format(12345678.46, ',').replace(',', ' ').replace('.', ',')
# upload uploaded file from path '/upload' to Google cloud storage 'my_bucket' bucket
upload_url = blobstore.create_upload_url('/upload', gs_bucket_name='my_bucket')
# Group the values from django model `Article` with group by value `pub_date` and annotate by `title`
Article.objects.values('pub_date').annotate(article_count=Count('title'))
# select all rows from pandas DataFrame 'df' where the value in column 'A' is greater than 1 or less than -1 in column 'B'.
df[(df['A'] > 1) | (df['B'] < -1)]
# check if all values in the columns of a numpy matrix `a` are same
np.all(a == a[(0), :], axis=0)
# replace `0` with `2` in the list `[0, 1, 0, 3]`
[(a if a else 2) for a in [0, 1, 0, 3]]
# Save array at index 0, index 1 and index 8 of array `np` to tmp file `tmp`
np.savez(tmp, *[getarray[0], getarray[1], getarray[8]])
# Getting the second to last element of list `some_list`
some_list[(-2)]
# gets the `n` th-to-last element in list `some_list`
some_list[(- n)]
# Produce a string that is suitable as Unicode literal from string 'M\\N{AMPERSAND}M\\N{APOSTROPHE}s'
'M\\N{AMPERSAND}M\\N{APOSTROPHE}s'.encode().decode('unicode-escape')
# Parse a unicode string `M\\N{AMPERSAND}M\\N{APOSTROPHE}s`
'M\\N{AMPERSAND}M\\N{APOSTROPHE}s'.decode('unicode-escape')
# sum values in list of dictionaries `example_list` with key 'gold'
sum(item['gold'] for item in example_list)
# get a sum of all values from key `gold` in a list of dictionary `example_list`
sum([item['gold'] for item in example_list])
# Get all the values in key `gold` summed from a list of dictionary `myLIst`
sum(item['gold'] for item in myLIst)
# replace '-' in pandas dataframe `df` with `np.nan`
df.replace('-', np.nan)
# normalize the dataframe `df` along the rows
np.sqrt(np.square(df).sum(axis=1))
# Sort a string `s` in lexicographic order
sorted(s, key=str.upper)
# sort string `s` in lexicographic order
sorted(sorted(s), key=str.upper)
# get a sorted list of the characters of string `s` in lexicographic order, with lowercase letters first
sorted(s, key=str.lower)
# insert a new field 'geolocCountry' on an existing document  'b' using pymongo
db.Doc.update({'_id': b['_id']}, {'$set': {'geolocCountry': myGeolocCountry}})
# pars a string 'http://example.org/#comments' to extract hashtags into an array
re.findall('#(\\w+)', 'http://example.org/#comments')
# assign the index of the last occurence of `x` in list `s` to the variable `last`
last = len(s) - s[::-1].index(x) - 1
# check if datafram `df` has any NaN vlaues
df.isnull().values.any()
# sum all elements of two-dimensions list `[[1, 2, 3, 4], [2, 4, 5, 6]]]`
sum([sum(x) for x in [[1, 2, 3, 4], [2, 4, 5, 6]]])
# Print a dictionary `{'user': {'name': 'Markus'}}` with string formatting
"""Hello {user[name]}""".format(**{'user': {'name': 'Markus'}})
# zip lists `[1, 2], [3, 4], [5, 6]` in a list
zip(*[[1, 2], [3, 4], [5, 6]])
# zip lists in a list [[1, 2], [3, 4], [5, 6]]
zip(*[[1, 2], [3, 4], [5, 6]])
# Add 100 to each element of column "x" in dataframe `a`
a['x'].apply(lambda x, y: x + y, args=(100,))
# get a list of of elements resulting from splitting user input by commas and stripping white space from each resulting string `s`
[s.strip() for s in input().split(',')]
# encode `u'X\xc3\xbcY\xc3\x9f'` as unicode and decode with utf-8
'X\xc3\xbcY\xc3\x9f'.encode('raw_unicode_escape').decode('utf-8')
# Jinja parse datetime object `car.date_of_manufacture` to use format pattern `datetime`
{{car.date_of_manufacture | datetime}}
# Get the date object `date_of_manufacture` of object `car` in string  format '%Y-%m-%d'
{{car.date_of_manufacture.strftime('%Y-%m-%d')}}
# convert a DateTime string back to a DateTime object of format '%Y-%m-%d %H:%M:%S.%f'
datetime.strptime('2010-11-13 10:33:54.227806', '%Y-%m-%d %H:%M:%S.%f')
# Pandas: How can I use the apply() function for a single column?
df['a'] = df['a'].apply(lambda x: x + 1)
# Get a list `myList` from 1 to 10
myList = [i for i in range(10)]
# find the mean of elements in list `l`
sum(l) / float(len(l))
# split string 'happy_hats_for_cats' using string '_for_'
re.split('_for_', 'happy_hats_for_cats')
# Split string 'sad_pandas_and_happy_cats_for_people' based on string 'and', 'or' or 'for'
re.split('_(?:for|or|and)_', 'sad_pandas_and_happy_cats_for_people')
# Split a string `l` by multiple words `for` or `or` or `and`
[re.split('_(?:f?or|and)_', s) for s in l]
# how to format a list of arguments `my_args` into a string
'Hello %s' % ', '.join(my_args)
# loop through 0 to 10 with step 2
for i in range(0, 10, 2):
    pass
# loop through `mylist` with step 2
for i in mylist[::2]:
    pass
# search and split string 'aaa bbb ccc ddd eee fff' by delimiter '(ddd)'
re.split('(ddd)', 'aaa bbb ccc ddd eee fff', 1)
# regex search and split string 'aaa bbb ccc ddd eee fff' by delimiter '(d(d)d)'
re.split('(d(d)d)', 'aaa bbb ccc ddd eee fff', 1)
# unescape special characters without splitting data in array of strings `['I ', u'<', '3s U ', u'&', ' you luvz me']`
"""""".join(['I ', '<', '3s U ', '&', ' you luvz me'])
# output first 100 characters in a string `my_string`
print(my_string[0:100])
# convert a dataframe `df`'s column `ID` into datetime, after removing the first and last 3 letters
pd.to_datetime(df.ID.str[1:-3])
# create 3 by 3 matrix of random numbers
numpy.random.random((3, 3))
# create a list with permutations of string 'abcd'
list(powerset('abcd'))
# prepend string 'hello' to all items in list 'a'
['hello{0}'.format(i) for i in a]
# get the opposite diagonal of a numpy array `array`
np.diag(np.rot90(array))
# get the average of a list values for each key in dictionary `d`)
[(i, sum(j) / len(j)) for i, j in list(d.items())]
# sort list `bar` by each element's attribute `attrb1` and attribute `attrb2` in reverse order
bar.sort(key=lambda x: (x.attrb1, x.attrb2), reverse=True)
# Represent DateTime object '10/05/2012' with format '%d/%m/%Y' into format '%Y-%m-%d'
datetime.datetime.strptime('10/05/2012', '%d/%m/%Y').strftime('%Y-%m-%d')
# find a tag `option` whose `value` attribute is `state` in selenium
driver.find_element_by_xpath("//option[@value='" + state + "']").click()
# write a regex pattern to match even number of letter `A`
re.compile('^([^A]*)AA([^A]|AA)*$')
# group rows of pandas dataframe `df` with same 'id'
df.groupby('id').agg(lambda x: x.tolist())
# list all files of a directory `mypath`
onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]
# list all files of a directory `mypath`
f = []
for (dirpath, dirnames, filenames) in walk(mypath):
    f.extend(filenames)
    break
# list all ".txt" files of a directory "/home/adam/"
print(glob.glob('/home/adam/*.txt'))
# list all files of a directory "somedirectory"
os.listdir('somedirectory')
# call parent class `Instructor` of child class constructor
super(Instructor, self).__init__(name, year)
# Get all the texts without tags from beautiful soup object `soup`
"""""".join(soup.findAll(text=True))
# format a string `num` using string formatting
"""{0:.3g}""".format(num)
# extract the first four rows of the column `ID` from a pandas dataframe `df`
df.groupby('ID').head(4)
# Convert escaped utf string to utf string in `your string`
print('your string'.decode('string_escape'))
# sort list `['14:10:01', '03:12:08']`
sorted(['14:10:01', '03:12:08'])
# count the number of True values associated with key 'success' in dictionary `d`
sum(1 if d['success'] else 0 for d in s)
# get the sum of values associated with the key ‘success’ for a list of dictionaries `s`
sum(d['success'] for d in s)
# replace unicode character '\u2022' in string 'str' with '*'
str.decode('utf-8').replace('\u2022', '*').encode('utf-8')
# replace unicode characters ''\u2022' in string 'str' with '*'
str.decode('utf-8').replace('\u2022', '*')
# sum a list of numbers `list_of_nums`
sum(list_of_nums)
# Spawn a process to run python script `myscript.py` in C++
system('python myscript.py')
# create file 'x' if file 'x' does not exist
fd = os.open('x', os.O_WRONLY | os.O_CREAT | os.O_EXCL)
# split a string `s` into integers
l = (int(x) for x in s.split())
# split a string `42 0` by white spaces.
"""42 0""".split()
# How to split a string into integers in Python?
map(int, '42 0'.split())
# getting a list of all subdirectories in the directory `directory`
os.walk(directory)
# get a list of all subdirectories in the directory `directory`
[x[0] for x in os.walk(directory)]
# update the dictionary `mydic` with dynamic keys `i` and values with key 'name' from dictionary `o`
mydic.update({i: o['name']})
# get a list of variables from module 'adfix.py' in current module.
print([item for item in dir(adfix) if not item.startswith('__')])
# update dictionary `b`, overwriting values where keys are identical, with contents of dictionary `d`
b.update(d)
# make a row-by-row copy `y` of array `x`
y = [row[:] for row in x]
# read excel file `file_name` using pandas
dfs = pd.read_excel(file_name, sheetname=None)
# Find all words containing letters between A and Z in string `formula`
re.findall('\\b[A-Z]', formula)
# How can I launch an instance of an application using Python?
os.system('start excel.exe <path/to/file>')
# create a flat dictionary by summing values associated with similar keys in each dictionary of list `dictlist`
dict((key, sum(d[key] for d in dictList)) for key in dictList[0])
# Remove all items from a dictionary `d` where the values are less than `1`
d = dict((k, v) for k, v in d.items() if v > 0)
# Filter dictionary `d` to have items with value greater than 0
d = {k: v for k, v in list(d.items()) if v > 0}
# split string 'fooxyzbar' based on case-insensitive matching using string 'XYZ'
re.compile('XYZ', re.IGNORECASE).split('fooxyzbar')