pyspark.pandas.DataFrame.to_dict???
-
数据Frame
to_dict
高山市 aent:str=dit, 中写:类型=)联 [链表 ,collections.abc.Mapping 万事通 ??? -
转换DataFrame词典
类型键值对可定制参数(见下文)。
注解
只有当生成的熊猫DataFrame预期小时才应使用这种方法,因为所有数据都装入驱动存储器中
- 参数解析
-
- 东点 splits
-
确定词典值类型
dict(默认值):dict像{clun->{index->值
名词像 {clun->[值
串行 : dict like {clun->series
split:dist像cindex'->Colunts->Colunts->Data->Squals
escords:链表像 [{clun->value},.
index:dist like {index->{clun->valu
缩写允许s级表示式数列并样板表示式拆分.
- 进进 类默认dict
-
集合.abc.mapping子类使用所有映射返回值可实际类或空实例映射类型需要集合时,默认时,必须传递初始化
- 回归
-
- 命令、列表或集合.abc.mapping
-
返回集合.abc.映射对象表示DataFrame产生变换依赖东点参数化
实例
>>>df=ss系统.数据Frame{{Coll:[一号,2万事通.ser2:[0.5,0.75},.索引化=[row1,row2万事通.列内=[Coll,ser2)>>>dfCol1col2第1行0.50行2 0.75
>>>f_dict=df.to_dict(b)>>>排序〔()密钥,排序高山市传值.项名)For密钥,传值内f_dict.项名)[(col1),[(srow2)2
可指定返回方向
>>>f_dict=df.to_dict高山市序列类)>>>排序高山市f_dict.项名)[(col1,第1行第二行2名称:col1,d类型:int64,行2 0.75名称:col2,d类型:浮点64
>>>f_dict=df.to_dict高山市破解)>>>排序高山市f_dict.项名)[(clunts),[col1,col2],(data),[s
>>>f_dict=df.to_dict高山市记录)>>>[排序高山市传值.项名)For传值内f_dict万事通[[('col1',1...),('col2',0.5],[//'col1',2
>>>f_dict=df.to_dict高山市索引)>>>排序〔()密钥,排序高山市传值.项名)For密钥,传值内f_dict.项名)[(srow1),[(col2),
也可以指定映射类型
>>>发自集合导入有序Dict,默认dict>>>df.to_dict高山市进进=有序Dict)ordedDict([(s'row1',1,2')),(sordedDict(s'row2',75)]
if you wanta默认dict需要初始化
>>>dd=默认dict高山市链表)>>>df.to_dict高山市记录,进进=dd)[默认项
{col.},col.},默认程序 .....