2024-11-24
pd.DataFrame() 数据框
pd.DataFrame(data,index,columns,dtype=None)
=====================================
import pandas as pd
a = pd.DataFrame([[1,2,3],
[4,5,6],
[7,8,9]])
输出a:
0 1 2
0 1 2 3
1 4 5 6
2 7 8 9
======================================
a = pd.DataFrame([[1,2,3],
[4,5,6],
[7,8,9]],
index = ['a','b','c'],
columns =['t','p','q'])
输出a:
t p q
a 1 2 3
b 4 5 6
c 7 8 9
======================================
#抽出其中一列为pd.Series对象
b = a['t']
b