I'm screwing around with python and its pandas library but I keep running into a problem. While copying through a tutorial, I try to get the version number for a couple libraries, but when I do so, I get the following: AttributeError: 'module' object has no attribute '_version_'
.
Everything else works just fine, but it really doesn't like '_version_'
for some reason. Anything I might be leaving out?
See below for the exact code.
import datetime
import pandas as pd
import pandas.io.data
from pandas import *
pd._version_
AttributeError: 'module' object has no attribute '_version_'
Use double underscores..
In [10]: pandas.__version__
Out[10]: '0.13.1'
Which is just a shorthand for pandas.version.version
PEP8
suggests using __version__
as the global variable to store a version number. Most libraries follow this and then offer a more readable variable or possibly a function which outputs the version in a usable form (like Django for example).