这里,df是我们的数据帧,在其中我们有我们的输出,因为我使用dataframewriter将整个输出写入目录,但是所有的数据都被分区,如下所述。。
$ hdfs dfs -ls /path to hdfs directory..
Found 4 items
-rw-r--r-- 3 xxxxxx xxxxxxx 0 2022-04-28 23:19 path to hdfs directory../_SUCCESS
-rw-r--r-- 3 xxxxxx xxxxxx 238 2022-04-28 23:19 path to hdfs directory../part-00000-4bc48c17-5c85-44be-bf34-3645d2b2e085-c000.csv
-rw-r--r-- 3 xxxxxxx xxxxxxx 6204498 2022-04-28 23:19 path to hdfs directory../part-00043-4bc48c17-5c85-44be-bf34-3645d2b2e085-c000.csv
-rw-r--r-- 3 xxxxxxx xxxxxxx 5875627 2022-04-28 23:19 path to hdfs directory../part-00191-4bc48c17-5c85-44be-bf34-3645d2b2e085-c000.csv
我想把所有的数据放在一个CSV文件中,代码中还有其他选项吗。。在下面
df.write.mode("overwrite").csv('path to hdfs directory', header = True, sep = ',')
数据约为df中的55k行。