import numpy as np
import pandas as pd########### Series ###########
Series <--> DataFrame
*dataframe* = pd.DataFrame({"XXX1":*series1*,"XXX2":*series2*})
*series* = *dataframe*[0] #无标签时
*series* = *dataframe*["XXX"] #有标签时Serise <--> ndarray
*series* = pd.Series(*ndarray*) #这里的ndarray是1维的
*ndarray* = np.array(*series*)
*ndarray* = *series*.valuesSeries <--> list
*series* = pd.Series(*list*)
*list* = *series*.tolist()
*list* = list(*series*)Series <--> dict
*series* = pd.Series(*dict*)
*dict* = *series*.to_dict()########### DataFrame ###########
DataFrame <--> ndarray
*ndarray* = *dataframe*.values
*dataframe* = pd.DataFrame(*ndarray*)DataFrame <--> list
*list* = *dataframe*.values.tolist()
*dataframe* = pd.DataFrame(*list*)DataFrame <--> dict
*dataframe* = pd.DataFrame.from_dict({0:*dict1*, 1:*dict2*})
*dataframe* = pd.DataFrame(*dict*)
*dict* = *dataframe*.to_dict()
*dict* = *dataframe*[['key_col', 'value_col']].set_index('key_col').to_dict()
(*dict* = dict['value_col'])########### 其它 list ###########
dict --> list
*list* = *dict*.values() # list of values
*list* = *dict*.keys() # list of keys
*list* = list(*dict*) # list of keysndarray <--> list
*list* = *ndarray*.tolist()
*ndarray* = np.array(*list*)tuple <--> list
*list* = list(*tuple*)
*tuple* = tuple(*list*)Index --> list
*dataframe*.columns.tolist()
参考链接:https://blog.csdn.net/lambsnow/article/details/78517340
dataframe = pd.DataFrame.from_dict()具体参数请参考文档:
http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.from_dict.html
dict = dataframe.to_dict()具体参数请参考文档:
http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.to_dict.html