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
nosetests: setup and teardown methods
nosetests is a tool used to build unit tests in python. Here below, I show an example on how to write a class that will perform some tests (test that a directory that has been created exists indeed). One issue … Continue reading
graphviz plot without graphviz…
Graphviz is a standard tools that is used to create images of graphs (see http://www.graphviz.org/). The graph are described thanks to a language. For instance the graph represented in the following image would be represented as A -> B B … Continue reading
How to plot left and right axis with matplotlib
Sometimes, it is convenient to plot 2 data sets that have not the same range within the same plots. One will use the left y-axes and the other will use the right y-axis. With matplotlib, you need to create subplots … Continue reading
How to call R plotting function from python using rpy2
Python has already very good librairies from plotting (e.g., matplotlib, mayavi), however, it is sometimes useful to use some of the plotting functionalities offered by R. Thanks to the rp2 package, it is quite easy. Let us try to use … Continue reading
ipython
If you start to use python, just install ipython to ease your life by having a more interactive python shell. http://ipython.org/ A nice feature in the ability to embed matplotlib plot. Start with this option: ipython qtconsole -pylab inlineipython qtconsole … Continue reading
Posted in Python
2 Comments
linux: How do I know the number of memory cards
The dmidecode command dumps lots of information about your system. The option memory gives you details about your memory card. In particular how many are installed (e.g., 2x2Gb or 1x 4Gb) sudo dmidecode -t memorysudo dmidecode -t memory
Posted in Linux
Leave a comment
VIM: switch all text to lower case
You can change the case of a character by typing ~ , however, if you want to change all text to the same case (let us say lower case here), then you should enter the visual mode. Go to the … Continue reading
How to embedded data files in python using setuptools
Within a Python package, it is useful to provide data files. These files are not python modules so you do not want to place same together with your module. Let us put them in a directory share/data. Suppose you have … Continue reading
HTML: How to redirect to another page
<meta HTTP-EQUIV="REFRESH" content="0; url=http://whatever"> <meta HTTP-EQUIV="REFRESH" content="0; url=http://whatever"> Note the syntax where content=”0; is not a typo. The content field contains both the URL to be redirect to and the delay (in seconds). In general, you may want to … Continue reading
installing rpy2 with different R version already installed
The easiest way to install a python package is to use easy_install (or pip), so to install rpy2, type: easy_install rpy2 To test that it is properly installed, type: import rpy2; from rpy2 import robjects; robjects.r(“version”) If this code works, … Continue reading