pandas的Dataframe的创建
Pandas的Dataframe是二维的,每一列都是一个Series结构。DataFrame数据的创建和Series的创建类似,可以有很多方式。
和Series一样也有字典类型的方式。
import numpy as np
import pandas as pd
df1 = pd.DataFrame({'name' : "hello the cruel world".split(),
'growth' : },
index = "jack tom mike nike".split())
print ('df1:\n', df1)
print (df1['growth']['mike'])# 等价于print df.growth['mike']
print (df1.name)# print df["name"]
df2 = pd.DataFrame(np.random.randn(10,3), columns = ["ca", "cb", "cc"],
index = list("abcdefghij"))
print ('df1:\n', df2)
页:
[1]