我有一个超过900列的巨 Big Data 集.部分栏目是世界语言.我想按字母顺序对数据集中的这部分列进行排序.我的解决方案是对数据集进行切片,将此子集分配给另一个变量,并对列进行排序.现在,我试图用排序的子集替换未排序的子集,但下面的代码没有起到作用.
lang_columns1=survey.iloc[:,19:104] #assigning subset of columns to a variable
lang_columns_sorted1 =lang_columns1.reindex(sorted(lang_columns1.columns), axis=1)
#sorting columns in alphabetical order by name
survey.iloc[:,19:104] = lang_columns_sorted1 #replacing the unsorted columns by the sorted columns
对如何解决这个问题有什么建议吗?