Pandas加载数据
import pandas as pd
from pandas import DataFrame,Series
import sys
- read_csv 从文件,URl,文件型对象中加载带分隔符的数据,默认分隔符为逗号(,)
- read_table 从文件,URl,文件型对象中加载带分隔符的数据,默认分隔符为制表符(\t)
pd.read_csv('ex1.csv')
.dataframe thead tr:only-child th { text-align: right; } .dataframe thead th { text-align: left; } .dataframe tbody tr th { vertical-align: top; }
|
a |
b |
c |
d |
message |
0 |
1 |
2 |
3 |
4 |
hello |
1 |
5 |
6 |
7 |
8 |
world |
2 |
9 |
10 |
11 |
12 |
foo |
pd.read_csv('ex2.csv',header=None)
.dataframe thead tr:only-child th { text-align: right; } .dataframe thead th { text-align: left; } .dataframe tbody tr th { vertical-align: top; }
|
0 |
1 |
2 |
3 |
4 |
0 |
1 |
2 |
3 |
4 |
hello |
1 |
5 |
6 |
7 |
8 |
world |
2 |
9 |
10 |
11 |
12 |
foo |
pd.read_csv('ex2.csv',names =['a','b','c','d','message'])</