upgade python version using pip

pip is designed to upgrade python packages and not to upgrade python itself. pip shouldn’t try to upgrade python when you ask it to do so. Don’t type pip install python but use an installer instead.

Converting strings to floats in a DataFrame

NOTE: pd.convert_objects has now been deprecated. You should use pd.Series.astype(float) or pd.to_numeric as described in other answers. This is available in 0.11. Forces conversion (or set’s to nan) This will work even when astype will fail; its also series by series so it won’t convert say a complete string column

Relative paths in Python

In the file that has the script, you want to do something like this: This will give you the absolute path to the file you’re looking for. Note that if you’re using setuptools, you should probably use its package resources API instead. UPDATE: I’m responding to a comment here so I can paste a code sample. 🙂 … Read more

Running Bash commands in Python

On my local machine, I run a python script which contains this line This works fine. Then I run the same code on a server and I get the following error message So what I did then is I inserted a print bashCommand which prints me than the command in the terminal before it runs it with os.system(). … Read more

Errno 13 Permission denied Python

Your user don’t have the right permissions to read the file, since you used open() without specifying a mode. Since you’re using Windows, you should read a little more about File and Folder Permissions. Also, if you want to play with your file permissions, you should right-click it, choose Properties and select Security tab. Or if you want to be a little more hardcore, you can … Read more