text
stringlengths 4
1.08k
|
|---|
Viewing the content of a Spark Dataframe Column,df.select('zip_code').collect()
|
Flask: How to remove cookies?,"resp.set_cookie('sessionID', '', expires=0)"
|
Convert zero-padded bytes to UTF-8 string,"'hiya\x00x\x00'.split('\x00', 1)[0]"
|
Pandas: how to change all the values of a column?,df['Date'].str[-4:].astype(int)
|
matplotlib (mplot3d) - how to increase the size of an axis (stretch) in a 3D Plot?,plt.show()
|
python - regex search and findall,"regex = re.compile('((\\d+,)*\\d+)')"
|
Passing the '+' character in a POST request in Python,"urlencode_withoutplus({'arg0': 'value', 'arg1': '+value'})"
|
Calcuate mean for selected rows for selected columns in pandas data frame,"df[['a', 'b', 'd']].iloc[[0, 1, 3]].mean(axis=0)"
|
splitting a string based on tab in the file,"re.split('\\t+', yas.rstrip('\t'))"
|
Django urlsafe base64 decoding with decryption,base64.urlsafe_b64decode(uenc.encode('ascii'))
|
Create an empty data frame with index from another data frame,df2 = pd.DataFrame(index=df1.index)
|
How to create a sequential combined list in python?,"['a', 'ab', 'abc', 'abcd', 'b', 'bc', 'bcd', 'c', 'cd', 'd']"
|
List of zeros in python,listofzeros = [0] * n
|
Anaphoric list comprehension in Python,[s for s in (square(x) for x in range(12)) if s > 50]
|
"Splitting a semicolon-separated string to a dictionary, in Python",dict(item.split('=') for item in s.split(';'))
|
Is there a method that tells my program to quit?,sys.exit(0)
|
"In Django, how do I check if a user is in a certain group?","return user.groups.filter(name__in=['group1', 'group2']).exists()"
|
Using multiple colors in matplotlib plot,plt.show()
|
Find maximum with limited length in a list,"[max(abs(x) for x in arr[i:i + 4]) for i in range(0, len(arr), 4)]"
|
Pandas: Get unique MultiIndex level values by label,df.index.get_level_values('co').unique()
|
Adding a 1-D Array to a 3-D array in Numpy,"np.zeros((6, 9, 20)) + np.array([1, 2, 3, 4, 5, 6, 7, 8, 9])[(None), :, (None)]"
|
How do I abort the execution of a Python script?,sys.exit()
|
How can i set the location of minor ticks in matplotlib,plt.show()
|
How can I add textures to my bars and wedges?,plt.show()
|
Python: Split string by list of separators,"split('ABC ; DEF123,GHI_JKL ; MN OP', (',', ';'))"
|
Sort a list by multiple attributes?,"s = sorted(s, key=lambda x: (x[1], x[2]))"
|
What's the easiest way to convert a list of hex byte strings to a list of hex integers?,"[int(x, 16) for x in ['BB', 'A7', 'F6', '9E']]"
|
Is there a Java equivalent for Python's map function?,"[1, 2, 3]"
|
Remove string from list if from substring list,[l.split('\\')[-1] for l in list_dirs]
|
Url decode UTF-8 in Python,print(urllib.parse.unquote(url).decode('utf8'))
|
Converting a list to a string,""""""""""""".join(buffer)"
|
Find maximum value of a column and return the corresponding row values using Pandas,df = df.reset_index()
|
"How do I modify a single character in a string, in Python?",print(''.join(a))
|
How can I do multiple substitutions using regex in python?,"re.sub('([abc])', '\\1\\1', text.read())"
|
How can I do multiple substitutions using regex in python?,"re.sub('(.)', '\\1\\1', text.read())"
|
How to clear Tkinter Canvas?,canvas.delete('all')
|
How to call Base Class's __init__ method from the child class?,"super(ChildClass, self).__init__(*args, **kwargs)"
|
Python Matplotlib - how to specify values on y axis?,plt.show()
|
Selecting specific column in each row from array,"a[np.arange(3), (0, 1, 0)]"
|
"List comprehension - converting strings in one list, to integers in another","[sum(map(int, s)) for s in example.split()]"
|
Python MySQLdb TypeError: not all arguments converted during string formatting,"cur.execute(""SELECT * FROM records WHERE email LIKE '%s'"", search)"
|
How to make good reproducible pandas examples,df.groupby('A').sum()
|
How to label a line in Python?,plt.show()
|
Filtering a list of strings based on contents,[k for k in lst if 'ab' in k]
|
passing variable from javascript to server (django),user_location = request.POST.get('location')
|
"Python: requests.get, iterating url in a loop","response = requests.get(url, headers=HEADERS)"
|
Modifying a subset of rows in a pandas dataframe,"df.ix[df.A == 0, 'B'] = np.nan"
|
How can I convert a binary to a float number,"float(int('-0b1110', 0))"
|
Python: Get the first character of a the first string in a list?,"['b', 's', 't']"
|
Changing image hue with Python PIL,new_img.save('tweeter_red.png')
|
Python regex alternative for join,"re.sub('(?<=.)(?=.)', '-', str)"
|
datetime.datetime.now() + 1,"datetime.datetime.now() + datetime.timedelta(days=1, hours=3)"
|
Python - Fastest way to check if a string contains specific characters in any of the items in a list,any(e in lestring for e in lelist)
|
Removing all non-numeric characters from string in Python,""""""""""""".join(c for c in 'abc123def456' if c.isdigit())"
|
Elegant way to transform a list of dict into a dict of dicts,"dict((d['name'], d) for d in listofdict)"
|
Print multiple arguments in python,"print(('Total score for', name, 'is', score))"
|
How can i set proxy with authentication in selenium chrome web driver using python,driver.get('http://www.google.com.br')
|
scatterplot with xerr and yerr with matplotlib,plt.show()
|
Regex to remove periods in acronyms?,"re.sub('(?<!\\w)([A-Z])\\.', '\\1', s)"
|
django filter with list of values,"Blog.objects.filter(pk__in=[1, 4, 7])"
|
python tkinter: displays only a portion of an image,"self.canvas.create_image(0, 0, image=image1, anchor=NW)"
|
sorting a list with objects of a class as its items,your_list.sort(key=operator.attrgetter('anniversary_score'))
|
Matplotlib axis labels: how to find out where they will be located?,plt.show()
|
How to center a window on the screen in Tkinter?,root.mainloop()
|
finding the last occurrence of an item in a list python,last = len(s) - s[::-1].index(x) - 1
|
PyQt QPushButton Background color,self.pushButton.setStyleSheet('background-color: red')
|
Python: How to convert a string containing hex bytes to a hex string,s.decode('hex')
|
Get list item by attribute in Python,items = [item for item in container if item.attribute == value]
|
split elements of a list in python,myList = [i.split('\t')[0] for i in myList]
|
Dict of dicts of dicts to DataFrame,"pd.concat(map(pd.DataFrame, iter(d.values())), keys=list(d.keys())).stack().unstack(0)"
|
Pandas - Sorting By Column,"pd.concat([df_1, df_2.sort_values('y')])"
|
How to reorder indexed rows based on a list in Pandas data frame,df.sort_index(ascending=False)
|
Python timedelta issue with negative values,"datetime.timedelta(-1, 86100).total_seconds()"
|
How to get a response of multiple objects using rest_framework and Django,"url('^combined/$', views.CombinedAPIView.as_view(), name='combined-list')"
|
Sorting a defaultdict by value in python,"sorted(list(d.items()), key=lambda k_v: k_v[1], reverse=True)"
|
Converting a String to List in Python,"""""""0,1,2"""""".split(',')"
|
How to make several plots on a single page using matplotlib?,fig.add_subplot(111)
|
How do I make python to wait for a pressed key,input('Press Enter to continue...')
|
Python Accessing Values in A List of Dictionaries,{d['Name']: d['Age'] for d in thisismylist}
|
Set Colorbar Range in matplotlib,plt.show()
|
Redirect user in Python + Google App Engine,self.redirect('http://www.appurl.com')
|
Subtracting the current and previous item in a list,"[(y - x) for x, y in zip(L, L[1:])]"
|
How can I remove text within parentheses with a regex?,"re.sub('\\([^)]*\\)', '', filename)"
|
Python: How can I find all files with a particular extension?,results += [each for each in os.listdir(folder) if each.endswith('.c')]
|
How to get every element in a list of list of lists?,[a for c in Cards for b in c for a in b]
|
How to do a 3D revolution plot in matplotlib?,plt.show()
|
Get the number of rows in table using SQLAlchemy,rows = session.query(Congress).count()
|
How do I merge two lists into a single list?,"[j for i in zip(a, b) for j in i]"
|
How to POST multiple FILES using Flask test client?,upload_files = request.files.getlist('file')
|
Changing image hue with Python PIL,return image.convert('HSV')
|
How to make print statement one line in python?,"print('If a hippo ways 2000 pounds, gives birth to a 100 pound calf and then eats a 50 pound meal how much does she weigh?')"
|
Merge DataFrames in Pandas using the mean,"pd.concat((df1, df2), axis=1).mean(axis=1)"
|
How to get the index with the key in Python dictionary?,list(x.keys()).index('c')
|
Flask - How to make an app externally visible through a router?,"app.run(host='192.168.0.58', port=9000, debug=False)"
|
Python Requests getting SSLerror,"requests.get('https://www.reporo.com/', verify=False)"
|
Pythonic way to write a for loop that doesn't use the loop index,"['_', 'empty', 'unused', 'dummy']"
|
Map two lists into a dictionary in Python,"new_dict = {k: v for k, v in zip(keys, values)}"
|
Max Value within a List of Lists of Tuple,"map(lambda x: max(x, key=lambda y: y[1]), lists)"
|
Sorting a list of tuples with multiple conditions,"list_.sort(key=lambda x: [x[0], len(x[1]), x[1]])"
|
Python Write bytes to file,"f = open('/tmp/output', 'wb')"
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.