import pandas as pd
import matplotlib.pyplot as plt
import numpy.random as np
import sys
import matplotlib
%matplotlib inline
import matplotlib.pyplot as plt
import numpy.random as np
import sys
import matplotlib
%matplotlib inline
1. 엑셀로 저장된 파일 열기
In [1]: df=pd.read_excel("example.xlsx", "kos", index_col="date")
In [2]: df.dtypes
Out[2]:
In [2]: df.dtypes
Out[2]:
op float64
hp float64
lp float64
cp float64
vol int64
dtype: object
hp float64
lp float64
cp float64
vol int64
dtype: object
In [3]: df.index
Out[3]:
Out[3]:
DatetimeIndex(['2010-01-04', '2010-01-05', '2010-01-06', '2010-01-07',
'2010-01-08', '2010-01-11', '2010-01-12', '2010-01-13',
'2010-01-14', '2010-01-15',
...
'2016-04-14', '2016-04-15', '2016-04-18', '2016-04-19',
'2016-04-20', '2016-04-21', '2016-04-22', '2016-04-25',
'2016-04-26', '2016-04-27'],
dtype='datetime64[ns]', name=u'date', length=1562, freq=None)
'2010-01-08', '2010-01-11', '2010-01-12', '2010-01-13',
'2010-01-14', '2010-01-15',
...
'2016-04-14', '2016-04-15', '2016-04-18', '2016-04-19',
'2016-04-20', '2016-04-21', '2016-04-22', '2016-04-25',
'2016-04-26', '2016-04-27'],
dtype='datetime64[ns]', name=u'date', length=1562, freq=None)
2. csv. 파일로 작성된 데이터의 호출
k=pd.read_csv(경로, sep=",", index_col="date")
댓글
댓글 쓰기