pyspark.sql.Column.dropFieldsgydF4y2Ba¶gydF4y2Ba
-
列。gydF4y2Ba
dropFieldsgydF4y2Ba
(gydF4y2Ba *gydF4y2Ba字段名gydF4y2Ba:gydF4y2BastrgydF4y2Ba )gydF4y2Ba→pyspark.sql.column.ColumngydF4y2Ba¶gydF4y2Ba -
滴字段的一個表達式gydF4y2Ba
StructTypegydF4y2Ba
的名字。這是一個空操作如果模式不包含字段名(年代)。gydF4y2Ba例子gydF4y2Ba
> > >gydF4y2Ba從gydF4y2Bapyspark.sqlgydF4y2Ba進口gydF4y2Ba行gydF4y2Ba> > >gydF4y2Ba從gydF4y2Bapyspark.sql.functionsgydF4y2Ba進口gydF4y2Ba上校gydF4y2Ba,gydF4y2Ba點燃gydF4y2Ba> > >gydF4y2BadfgydF4y2Ba=gydF4y2Ba火花gydF4y2Ba。gydF4y2BacreateDataFramegydF4y2Ba([gydF4y2Ba…gydF4y2Ba行gydF4y2Ba(gydF4y2Ba一個gydF4y2Ba=gydF4y2Ba行gydF4y2Ba(gydF4y2BabgydF4y2Ba=gydF4y2Ba1gydF4y2Ba,gydF4y2BacgydF4y2Ba=gydF4y2Ba2gydF4y2Ba,gydF4y2BadgydF4y2Ba=gydF4y2Ba3gydF4y2Ba,gydF4y2BaegydF4y2Ba=gydF4y2Ba行gydF4y2Ba(gydF4y2BafgydF4y2Ba=gydF4y2Ba4gydF4y2Ba,gydF4y2BaggydF4y2Ba=gydF4y2Ba5gydF4y2Ba,gydF4y2BahgydF4y2Ba=gydF4y2Ba6gydF4y2Ba)))))gydF4y2Ba> > >gydF4y2BadfgydF4y2Ba。gydF4y2BawithColumngydF4y2Ba(gydF4y2Ba“一個”gydF4y2Ba,gydF4y2BadfgydF4y2Ba(gydF4y2Ba“一個”gydF4y2Ba]gydF4y2Ba。gydF4y2BadropFieldsgydF4y2Ba(gydF4y2Ba“b”gydF4y2Ba))gydF4y2Ba。gydF4y2Ba顯示gydF4y2Ba()gydF4y2Ba+ - - - - - - - - - - - - - - - - - - +gydF4y2Ba|的|gydF4y2Ba+ - - - - - - - - - - - - - - - - - - +gydF4y2Ba| {2 3 {4、5、6}}|gydF4y2Ba+ - - - - - - - - - - - - - - - - - - +gydF4y2Ba
> > >gydF4y2BadfgydF4y2Ba。gydF4y2BawithColumngydF4y2Ba(gydF4y2Ba“一個”gydF4y2Ba,gydF4y2BadfgydF4y2Ba(gydF4y2Ba“一個”gydF4y2Ba]gydF4y2Ba。gydF4y2BadropFieldsgydF4y2Ba(gydF4y2Ba“b”gydF4y2Ba,gydF4y2Ba“c”gydF4y2Ba))gydF4y2Ba。gydF4y2Ba顯示gydF4y2Ba()gydF4y2Ba+ - - - - - - - - - - - - - - - - +gydF4y2Ba|的|gydF4y2Ba+ - - - - - - - - - - - - - - - - +gydF4y2Ba| {3,{4、5、6}}|gydF4y2Ba+ - - - - - - - - - - - - - - - - +gydF4y2Ba
這種方法支持如直接刪除多個嵌套的字段。gydF4y2Ba
> > >gydF4y2BadfgydF4y2Ba。gydF4y2BawithColumngydF4y2Ba(gydF4y2Ba“一個”gydF4y2Ba,gydF4y2Ba上校gydF4y2Ba(gydF4y2Ba“一個”gydF4y2Ba)gydF4y2Ba。gydF4y2BadropFieldsgydF4y2Ba(gydF4y2Ba“如”gydF4y2Ba,gydF4y2Ba“e.h”gydF4y2Ba))gydF4y2Ba。gydF4y2Ba顯示gydF4y2Ba()gydF4y2Ba+ - - - - - - - - - - - - - - - - +gydF4y2Ba|的|gydF4y2Ba+ - - - - - - - - - - - - - - - - +gydF4y2Ba| {1,2,3,{4}}|gydF4y2Ba+ - - - - - - - - - - - - - - - - +gydF4y2Ba
然而,如果你想添加/替換多個嵌套的字段,它是首選的提取出添加/更換多個字段如前嵌套的結構體。gydF4y2Ba
> > >gydF4y2BadfgydF4y2Ba。gydF4y2Ba選擇gydF4y2Ba(gydF4y2Ba上校gydF4y2Ba(gydF4y2Ba“一個”gydF4y2Ba)gydF4y2Ba。gydF4y2BawithFieldgydF4y2Ba(gydF4y2Ba…gydF4y2Ba“e”gydF4y2Ba,gydF4y2Ba上校gydF4y2Ba(gydF4y2Ba“醯”gydF4y2Ba)gydF4y2Ba。gydF4y2BadropFieldsgydF4y2Ba(gydF4y2Ba“g”gydF4y2Ba,gydF4y2Ba“h”gydF4y2Ba))gydF4y2Ba。gydF4y2Ba別名gydF4y2Ba(gydF4y2Ba“一個”gydF4y2Ba)gydF4y2Ba…gydF4y2Ba)gydF4y2Ba。gydF4y2Ba顯示gydF4y2Ba()gydF4y2Ba+ - - - - - - - - - - - - - - - - +gydF4y2Ba|的|gydF4y2Ba+ - - - - - - - - - - - - - - - - +gydF4y2Ba| {1,2,3,{4}}|gydF4y2Ba+ - - - - - - - - - - - - - - - - +gydF4y2Ba