1."一维数组"Series Pandas数据结构Series:基本概念及创建 s.index . s.values # Series 数据结构 # Series 是带有标签的一维数组,可以保存任何数据类型(整数,字符串,浮点数,Python对象等),轴标签统称为索引 import numpy as npimport pandas as pd>>> s = pd.Series(np.random.rand(5)) >>> print(s,type(
pandas包 # 引入包 import pandas as pd import numpy as np import matplotlib.pyplot as plt Series Series 是一维带标签的数组,数组里可以放任意的数据(整数,浮点数,字符串,Python Object).其基本的创建函数是: s = pd.Series(data, index=index) 其中 index 是一个列表,用来作为数据的标签.data 可以是不同的数据类型: Python 字典 ndarray
python. pandas(series,dataframe,index,reindex,csv file read and write) method test import pandas as pdimport numpy as np def testpandas(): p = pd.Series([1,2,3,4,5],index =('a','b','c','d','e')) print(p) cities = {'bejing':5500,'shanghai':5999,'shezh