In [1]:
import pandas as pd
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
%matplotlib inline

In [2]:
pwd


Out[2]:
u'/home/tedlaz/python_work'

In [3]:
from tedutil import isozygio

In [4]:
db = '/home/tedlaz/python_work/tedutil/gasbah1.sql3'
sql = """select logistiki_tran.imnia as dat, substr(logistiki_lmo.code,1,2) as lmo, logistiki_tran_d.xr, logistiki_tran_d.pi 
from logistiki_tran_d 
inner join logistiki_tran on logistiki_tran.id=logistiki_tran_d.tran_id 
inner join logistiki_lmo on logistiki_lmo.id=logistiki_tran_d.lmos_id
Where logistiki_lmo.code like '%'"""
aa, stt = isozygio.arr(db, sql, 'm3')

In [5]:
pd.set_option('display.notebook_repr_html', True)
pd.set_option('display.max_columns', 100)
pd.set_option('display.max_rows', 1000)
pd.set_option('display.width', 5000) 
pd.set_option('display.mpl_style', 'default') # Make the graphs a bit prettier
plt.rcParams['figure.figsize'] = (15, 7)


/usr/lib/python2.7/site-packages/matplotlib/__init__.py:892: UserWarning: axes.color_cycle is deprecated and replaced with axes.prop_cycle; please use the latter.
  warnings.warn(self.msg_depr % (key, alt_key))
/usr/lib/python2.7/site-packages/matplotlib/__init__.py:872: UserWarning: axes.color_cycle is deprecated and replaced with axes.prop_cycle; please use the latter.
  warnings.warn(self.msg_depr % (key, alt_key))

In [6]:
asd = pd.DataFrame(aa)
asd.columns = stt
asd.set_index('Lmoi', inplace=True)
asd.index.name = None
asd = asd.replace('-', 'NaN', regex=True).astype('float')
asd.T.plot(kind='bar')


Out[6]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f36387a7710>

In [7]:
np.random.seed(111111)
s = pd.Series(np.random.randn(1096), index=pd.date_range('2012-01-01', '2014-12-31'))
walk_ts = s.cumsum()
pd.options.display.mpl_style = 'default'
walk_ts.plot()


Out[7]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f3638af4150>

In [8]:
aa = pd.Series([100, 200, 300, 200, 100], index=['2011', '2012', '2013', '2014', '2015'])
aa


Out[8]:
2011    100
2012    200
2013    300
2014    200
2015    100
dtype: int64

In [ ]: