按列合并多个csv文件的最快方法是什么? [英] What's the fastest way to merge multiple csv files by column?
问题描述
我大约有50个CSV文件,每个文件有60,000行,并且列数也各不相同.我想按列合并所有CSV文件.我已经尝试在MATLAB中通过转置每个csv文件并将其重新保存到磁盘,然后使用命令行将它们串联来进行此操作.这花了我一个多星期的时间,最终结果需要再次转置!我必须再次执行此操作,并且正在寻找不会再花一周的解决方案.任何帮助将不胜感激.
I have about 50 CSV files with 60,000 rows in each, and a varying number of columns. I want to merge all the CSV files by column. I've tried doing this in MATLAB by transposing each csv file and re-saving to disk, and then using the command line to concatenate them. This took my computer over a week and the final result needs to transposed once again! I have to do this again, and I'm looking for a solution that won't take another week. Any help would be appreciated.
推荐答案
[...]转置每个csv文件并重新保存到磁盘,然后使用命令行将它们串联起来[...]
[...] transposing each csv file and re-saving to disk, and then using the command line to concatenate them [...]
类似Transpose-Cat-Transpose的声音.使用粘贴来水平连接文件.
Sounds like Transpose-Cat-Transpose. Use paste for joining files horizontally.
paste -d ',' a.csv b.csv c.csv ... > result.csv
这篇关于按列合并多个csv文件的最快方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!