In [1]:
%matplotlib inline
import numpy as np
import pandas as pd
from scipy import stats, integrate
import matplotlib.pyplot as plt
import seaborn as sns
sns.set(color_codes=True)
sns.set_style("whitegrid")
In [11]:
head = ["ip-agent","a", "b","c","timestamp","url","refer","code","status","agent","ip","cookie","time"]
access = pd.read_csv('/Users/page/data/159_access_d_20160901.log',sep='\t', header=None, names=head)
/usr/local/lib/python3.5/site-packages/IPython/core/interactiveshell.py:2717: DtypeWarning: Columns (4) have mixed types. Specify dtype option on import or set low_memory=False.
interactivity=interactivity, compiler=compiler, result=result)
In [12]:
access.head()
Out[12]:
ip-agent
a
b
c
timestamp
url
refer
code
status
agent
ip
cookie
time
0
10.90.1.182
-
-
-
1472659202490
http://auto.ifeng.com/guangzhou/tuangou/2016/0...
http://www.ifeng.com/
200.0
43.0
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKi...
113.74.111.166
1448538609809_tidue95116
1472659199606
1
10.90.1.193
-
-
-
1472659203901
http://auto.ifeng.com/changchun/daogou/2016/08...
http://www.ifeng.com/
200.0
43.0
Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.3...
117.174.26.230
1406908003515_ftnuvn1818
1472659082403
2
10.90.1.188
CN141000
1608161948405984
-
1472659203115
http://auto.ifeng.com/taiyuan/jiangjia/2016/08...
http://www.ifeng.com/
200.0
43.0
Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.3...
60.221.114.81
1466610361287_pie7i6544
1472659576990
3
10.90.1.188
-
-
-
1472659205560
http://auto.ifeng.com/beijing/jiangjia/2016/03...
http://auto.ifeng.com/beijing/jiangjia/2016/03...
200.0
43.0
Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.3...
39.84.12.62
1465905016149_yr6nb75899
1472659336796
4
10.90.1.188
-
-
-
1472659206814
http://auto.ifeng.com/changchun/daogou/2016/08...
http://auto.ifeng.com/changchun/daogou/2016/08...
200.0
43.0
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKi...
122.188.13.45
1436240220421_r87y6k4127
1472659124800
In [17]:
access.hist("refer")
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-17-6a7c1522e6f5> in <module>()
----> 1 access.hist("refer")
/usr/local/lib/python3.5/site-packages/pandas/tools/plotting.py in hist_frame(data, column, by, grid, xlabelsize, xrot, ylabelsize, yrot, ax, sharex, sharey, figsize, layout, bins, **kwds)
2919 fig, axes = _subplots(naxes=naxes, ax=ax, squeeze=False,
2920 sharex=sharex, sharey=sharey, figsize=figsize,
-> 2921 layout=layout)
2922 _axes = _flatten(axes)
2923
/usr/local/lib/python3.5/site-packages/pandas/tools/plotting.py in _subplots(naxes, sharex, sharey, squeeze, subplot_kw, ax, layout, layout_type, **fig_kw)
3412
3413 # Create first subplot separately, so we can share it if requested
-> 3414 ax0 = fig.add_subplot(nrows, ncols, 1, **subplot_kw)
3415
3416 if sharex:
/usr/local/lib/python3.5/site-packages/matplotlib/figure.py in add_subplot(self, *args, **kwargs)
1018 self._axstack.remove(ax)
1019
-> 1020 a = subplot_class_factory(projection_class)(self, *args, **kwargs)
1021
1022 self._axstack.add(key, a)
/usr/local/lib/python3.5/site-packages/matplotlib/axes/_subplots.py in __init__(self, fig, *args, **kwargs)
62 raise ValueError(
63 "num must be 1 <= num <= {maxn}, not {num}".format(
---> 64 maxn=rows*cols, num=num))
65 self._subplotspec = GridSpec(rows, cols)[int(num) - 1]
66 # num - 1 for converting from MATLAB to python indexing
ValueError: num must be 1 <= num <= 0, not 1
<matplotlib.figure.Figure at 0x11607f0b8>
In [ ]:
Content source: LogicWang/ml
Similar notebooks: