# 有一个Series对象如下
type_series=pd.Series(data=[8944510,559132,291657,199147],
index=['pv','cart','fav','buy'])
"""
pv 8944510
cart 559132
fav 291657
buy 199147
Name: type, dtype: int64
"""
Pandas库里面DataFrame的介绍
这里type_series
是Series对象,根据DataFrame的index介绍,Index to use for resulting frame. Will default to RangeIndex if no indexing information part of input data and no index provided.
翻译一下:index:数据框的索引。如果输入数据没有索引信息也没有提供索引,将默认为RangeIndex。
也就是说type_series
Series对象转换为DataFrame对象的索引仍然是type_series
的索引,因此如下图。
这里[type_series]
是一个列表对象,把这个列表对象输入pd.DataFrame,index会重建
columns:数据框的列。如果输入数据没有列标签的话,将默认为RangeIndex。