text
stringlengths 4
1.08k
|
|---|
How to add a second x-axis in matplotlib,plt.show()
|
Multiple pipes in subprocess,p.wait()
|
How to rearrange Pandas column sequence?,cols = list(df.columns.values)
|
Is there a way to plot a Line2D in points coordinates in Matplotlib in Python?,plt.show()
|
Best way to abstract season/show/episode data,raise self.__class__.__name__
|
Want to plot Pandas Dataframe as Multiple Histograms with log10 scale x-axis,ax.set_xscale('log')
|
how to draw a heart with pylab,pylab.savefig('heart.png')
|
Python string representation of binary data,binascii.hexlify('\r\x9eq\xce')
|
Split a string into 2 in Python,"firstpart, secondpart = string[:len(string) / 2], string[len(string) / 2:]"
|
rename multiple files in python,"os.rename(file, new_name)"
|
How to assign items inside a Model object with Django?,my_model.save()
|
How do I redefine functions in python?,module1.func1('arg1')
|
Regular expression to return all characters between two special characters,match.group(1)
|
Django password reset email subject,"('^password_reset/$', 'your_app.views.password_reset'),"
|
Encoding binary data in flask/jinja2,entry['image'] = entry['image'].encode('base64')
|
Recursive pattern in regex,"regex.findall('{((?>[^{}]+|(?R))*)}', '{1, {2, 3}} {4, 5}')"
|
Python/Django: Getting random articles from huge table,MyModel.objects.order_by('?')[:10]
|
How to set the font size of a Canvas' text item?,"canvas.create_text(x, y, font='Purisa', size=mdfont, text=k)"
|
How to save an image using django imageField?,img.save()
|
Printing a list of numbers in python v.3,"print('\t'.join(map(str, [1, 2, 3, 4, 5])))"
|
How do I specify a range of unicode characters in a regular-expression in python?,"""""""[\\u00d8-\\u00f6]"""""""
|
Using slicers on a multi-index,"df.loc[(slice(None), '2014-05'), :]"
|
making matplotlib graphs look like R by default?,plt.show()
|
One-line expression to map dictionary to another,"dict((m.get(k, k), v) for k, v in list(d.items()))"
|
Sorting a 2D list alphabetically?,lst.sort()
|
Slicing a multidimensional list,[x[0] for x in listD[2]]
|
Resampling Within a Pandas MultiIndex,df['Date'] = pd.to_datetime(df['Date'])
|
How to check if a variable is an integer or a string?,value.isdigit()
|
Drawing a huge graph with networkX and matplotlib,plt.savefig('graph.pdf')
|
How to convert nested list of lists into a list of tuples in python 3.3?,[tuple(l) for l in nested_lst]
|
Reading integers from binary file in Python,"print(struct.unpack('i', fin.read(4)))"
|
2D arrays in Python,"myArray = [{'pi': 3.1415925, 'r': 2}, {'e': 2.71828, 'theta': 0.5}]"
|
Handle wrongly encoded character in Python unicode string,some_unicode_string.encode('utf-8')
|
Selenium: Wait until text in WebElement changes,"wait.until(EC.visibility_of_element_located((By.CLASS_NAME, 'searchbox')))"
|
How do I transform a multi-level list into a list of strings in Python?,"map(''.join, a)"
|
python: dots in the name of variable in a format string,print('Name: %(person.name)s' % {'person.name': 'Joe'})
|
How to keep a Python script output window open?,input('Press enter to exit ;)')
|
Swapping columns in a numpy array?,"my_array[:, ([0, 1])] = my_array[:, ([1, 0])]"
|
pandas groupby sort within groups,"df_agg = df.groupby(['job', 'source']).agg({'count': sum})"
|
How can I find the missing value more concisely?,"z = (set(('a', 'b', 'c')) - set((x, y))).pop()"
|
Separating a String,"['abcd', 'a,bcd', 'a,b,cd', 'a,b,c,d', 'a,bc,d', 'ab,cd', 'ab,c,d', 'abc,d']"
|
Can I change SOCKS proxy within a function using SocksiPy?,"sck.setproxy(socks.PROXY_TYPE_SOCKS5, '127.0.0.1', 9050)"
|
Pandas reset index on series to remove multiindex,"s.reset_index().drop(1, axis=1)"
|
"Python, remove all occurrences of string in list",new_array = [x for x in main_array if x not in second_array]
|
Check at once the boolean values from a set of variables,"x = all((a, b, c, d, e, f))"
|
How to save Pandas pie plot to a file,fig.savefig('~/Desktop/myplot.pdf')
|
How to render an ordered dictionary in django templates?,"return render(request, 'main.html', {'context': ord_dict})"
|
Finding the extent of a matplotlib plot (including ticklabels) in axis coordinates,fig.savefig('so_example.png')
|
How to intergrate Python's GTK with gevent?,gtk.main()
|
Accessing OrientDB from Python,python - -version
|
Dynamic module import in Python,my_module = importlib.import_module('os.path')
|
Equivalent of objects.latest() in App Engine,MyObject.all().order('-time')[0]
|
String formatting in Python,"print('[%i, %i, %i]' % tuple(numberList))"
|
Writing a csv file into SQL Server database using python,cursor.commit()
|
Python - Find text using beautifulSoup then replace in original soup variable,findtoure = commentary.find(text=re.compile('Yaya Toure'))
|
How can I randomly place several non-colliding rects?,random.seed()
|
Pythonic way to insert every 2 elements in a string,"[(a + b) for a, b in zip(s[::2], s[1::2])]"
|
Find gaps in a sequence of Strings,"list(find_gaps(['0000001', '0000003', '0000006']))"
|
3 Different issues with ttk treeviews in python,"ttk.Style().configure('.', relief='flat', borderwidth=0)"
|
Getting a JSON request in a view (using Django),return HttpResponse('')
|
What's the proper way to write comparator as key in Python 3 for sorting?,"print(sorted(l, key=my_key))"
|
Setting the size of the plotting canvas in Matplotlib,"plt.savefig('D:\\mpl_logo_with_title.png', dpi=dpi)"
|
Selecting rows from a NumPy ndarray,"test[numpy.apply_along_axis(lambda x: x[1] in wanted, 1, test)]"
|
python regex to match only first instance,"re.sub('-----.*?-----', '', data, 1)"
|
Regex matching 5-digit substrings not enclosed with digits,"re.findall('\\b\\d{5}\\b', 'Helpdesk-Agenten (m/w) Kennziffer: 12966')"
|
"Converting a list into comma-separated string with ""and"" before the last item - Python 2.7","""""""{} and {}"""""".format(', '.join(listy[:-1]), listy[-1])"
|
Vectorize over the rows of an array,"numpy.apply_along_axis(sum, 1, X)"
|
Pythonic way to find maximum value and its index in a list?,max_index = my_list.index(max_value)
|
"Can you create a Python list from a string, while keeping characters in specific keywords together?","re.findall('car|rat|[a-z]', s)"
|
how to spawn new independent process in python,"Popen(['nohup', 'script.sh'], stdout=devnull, stderr=devnull)"
|
Multiply high order matrices with numpy,"np.einsum('ijk,ij->ik', ind, dist)"
|
Numpy Array Broadcasting with different dimensions,"v.dot(np.rollaxis(a, 2, 1))"
|
How to get current import paths in Python?,print(sys.path)
|
python split function -avoids last empy space,[x for x in my_str.split(';') if x]
|
Python Pandas: How to move one row to the first row of a Dataframe?,df.set_index('a')
|
How do I blit a PNG with some transparency onto a surface in Pygame?,pygame.display.flip()
|
How to remove item from a python list if a condition is True?,x = [i for i in x if len(i) == 2]
|
Python list-comprehension for words that do not consist solely of digits,[word for word in words if any(not char.isdigit() for char in word)]
|
Create broken symlink with Python,"os.symlink('/usr/bin/python', '/tmp/subdir/python')"
|
How to add a second x-axis in matplotlib,plt.show()
|
How do I remove \n from my python dictionary?,"key, value = line.rstrip('\n').split(',')"
|
"Python, print delimited list","print(','.join(str(x) for x in a))"
|
pandas - get most recent value of a particular column indexed by another column (get maximum value of a particular column indexed by another column),df.groupby('obj_id').agg(lambda df: df.values[df['data_date'].values.argmax()])
|
Python string replacement,"re.sub('\\bugh\\b', 'disappointed', 'laughing ugh')"
|
How to zip two lists of lists in Python?,"[(x + y) for x, y in zip(L1, L2)]"
|
Getting the output of a python subprocess,out = p.communicate()
|
Django - CSRF verification failed,"return render(request, 'contact.html', {form: form})"
|
Python - Fastest way to check if a string contains specific characters in any of the items in a list,[(e in lestring) for e in lelist if e in lestring]
|
I want to plot perpendicular vectors in Python,"plt.figure(figsize=(6, 6))"
|
Fastest Way to Update a bunch of records in queryset in Django,Entry.objects.all().update(value=not F('value'))
|
Check for a cookie with Python Flask,request.cookies.get('my_cookie')
|
Dynamically updating plot in matplotlib,plt.draw()
|
Removing white space from txt with python,"print(re.sub('(\\S)\\ {2,}(\\S)(\\n?)', '\\1|\\2\\3', s))"
|
Using Django ORM get_or_create with multiple databases,MyModel.objects.using('my_non_default_database').get_or_create(name='Bob')
|
Initialize a datetime object with seconds since epoch,datetime.datetime.fromtimestamp(1284286794)
|
non-destructive version of pop() for a dictionary,"k, v = next(iter(list(d.items())))"
|
matplotlib legend showing double errorbars,plt.legend(numpoints=1)
|
converting file from .txt to .csv doesn't write last column of data,writer.writerows(row.split() for row in infile if row.strip())
|
Mapping a nested list with List Comprehension in Python?,nested_list = [[s.upper() for s in xs] for xs in nested_list]
|
Save a list of objects in django,o.save()
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.