Pandas
跳到导航
跳到搜索
Python Data Analysis Library
io
- read_csv
import pandas as pd data=pd.read_csv('cGs_for_LAMOST.csv') data.columns ra=data['ra'] dec=data['dec]
- read_table
:读普通的ascii文件
file=pd.read_table(path+'test1.spectrum',skiprows=range(0,6),\ delim_whitespace=True, names=('A', 'B', 'C'), dtype={'A': np.int64, 'B': np.float64, 'C': np.float64})
pickle
- 使用DataFrame的to_pickle属性就可以生成pickle文件对数据进行永久储存
df = pd.DataFrame(np.arange(20).reshape(4,5)) df.to_pickle('foo.pkl') pd.read_pickle('foo.pkl')