What is an alternative to execfile in Python 3??

It seems they canceled in Python 3 all the easy way to quickly load a script by removing execfile() Is there an ob...

'module' has no attribute 'urlencode'?

When I try to follow the Python Wiki's example related to URL encoding: >>> import urllib >>> par...

IndentationError: unindent does not match any outer indentation level?

When I compile the Python code below, I get IndentationError: unindent does not match any outer indentation lev...

Scrolling line pyqtgraph?

I'd like to continuously plot sensor data, and occasionally draw vertical lines to represent events. I can get the s...

How do I do a not equal in Django queryset filtering??

In Django model QuerySets, I see that there is a __gt and __lt for comparitive values, but is there a __ne/!=/<&g...

python - invalid value encountered in log?

I have the following expression: log = np.sum(np.nan_to_num(-y*np.log(a+ 1e-7)-(1-y)*np.log(1-a+ 1e-7))) it is givi...

What is the point of float('inf') in Python??

Just wondering over here, what is the point of having a variable store an infinite value in a program? Is there any ...

Truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()?

Having issue filtering my result dataframe with an or condition. I want my result df to extract all column var value...

How to select all columns, except one column in pandas??

I have a dataframe look like this: import pandas import numpy as np df = DataFrame(np.random.rand(4,4), columns = l...

Why is there no tuple comprehension in Python??

As we all know, there's list comprehension, like [i for i in [1, 2, 3, 4]] and there is dictionary comprehension,...

Pandas read_csv low_memory and dtype options?

When calling df = pd.read_csv('somefile.csv') I get: /Users/josh/anaconda/envs/py27/lib/python2.7/site-packag...

How to check if a column exists in Pandas?

Is there a way to check if a column exists in a Pandas DataFrame? Suppose that I have the following DataFrame: &gt...

How to clear Tkinter Canvas??

When I draw a shape using: canvas.create_rectangle(10, 10, 50, 50, color="green") Does Tkinter keep track of the ...

Create random shape/contour using matplotlib?

I am trying to generate an image of a random contour using python but I couldn't find an easy way to do it. Here is...

'int' object has no attribute '__getitem__'?

import math import os class collection: col = [[0 for col in range(5)] for row in range(6)] dist = [[0 for...