[英]Concat the csv files by column using pd function
I tried to combine some csv by columns我试图按列组合一些 csv
I use the pd.contcat, however I found out it concat by rows instead of columns.我使用 pd.contcat,但是我发现它按行而不是列连接。
combined_csv = pd.concat([pd.read_csv(f, header=None) for f in files_in_dir])
is there a function in pd that I can combine csv files by column instead of rows? pd 中是否有一个函数可以按列而不是按行组合 csv 文件?
why dont you try你为什么不试试
import pandas as pd
pd.concat([df1,df2],axis=1)
else give axis=1 as a parameter in your code否则在代码中将 axis=1 作为参数
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.