Follow me
-
Recent Posts
calendar
December 2024 M T W T F S S 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 Recent Comments
- Stan on python argparse issues with the help argument (TypeError: %o format: a number is required, not dict)
- Cormac on Pandas : how to compare dataframe with None
- LP on AWK: the substr command to select a substring
- jrab on python argparse issues with the help argument (TypeError: %o format: a number is required, not dict)
- How to disable SSL verification for urlretrieve? – Peter's blog on python: certificate verified failed
Archives
Categories
Meta
Author Archives: Thomas Cokelaer
Python function chmod to change permission
I naively tried the function chmod from the standard python module called os to change the permission of a file: os.chmod(filename, 644)os.chmod(filename, 644) Checking in the unix command line (ls -l), I got an unexpected result: –w—-r-T.–w—-r-T. I expected indeed … Continue reading
green flash / rayon vert
For a change, here is a nice picture taken yesterday showing the green ray that can be sometimes seen when the last ray of the upper rim of the sun hung on the skyline. and here, let us focus on … Continue reading
Posted in photos
Leave a comment
Pandas : how to compare dataframe with None
While comparing a pandas dataframe with None, import pandas as pd df = pd.DataFrame() # Note that the dataframe is empty but it does not matter for this example. if df == None: pass # do nothing else: df.describe()import pandas … Continue reading
pygame installation not working due to “linux/videodev.h: No such file or directory” error
I wanted to install the python package called pygame. I encountered quite a few issues before being able to install it. I’m reporting here some of the solutions. Before starting, keep in mind that you can install pygame using apt-get … Continue reading
perl: define a module to be called in another script
First, define a module. The module must be in a path reachable by perl (e.g., local directory). Then, to make a script a valid package, you need to proceed as follows: Rename the perl script with the extension .pm It … Continue reading
sed: how to add text at the end of the file
Use the $a syntax and sed: sed -i ‘$a some text’ filenamesed -i ‘$a some text’ filename -i parameter means in place. To test without changing the original file, remove the -i option. The results will be print on the … Continue reading
Open VID file in VirtualBox
I’ve been using VirtualBox for a few years mostly to test software on different distributions. This is really a great tool really easy to use. I usually get an ISO file from a distribution (e.g. Fedora) and install it within … Continue reading
matplotlib: difference between pcolor, pcolormesh and imshow
If you have a matrix and want to plot its content as an image, matplotlib provides some functions such as imshow and pcolor. c Differences between imshow and pcolor Let us use a simple 3 by 3 matrix and call … Continue reading
Python editor
The general purpose tool I used for edition is vim… I know, this is not very friendly but to edit a couple of files, it’s fast to start, fast to edit, has completion and much more. Yet, sometimes, a dedicated … Continue reading
Accessing UniProt with Python
BioServices provide an easy way to access UniProt In a previous post, I provided a simple example, reproduced here below, but in this post I also provide the link to a ipython notebook I’ve just created, which contains much more … Continue reading