I want to combine csvs with the same number of columns so that one side is set to header
What I've tried
Columns: [a,b,c]Index: [ ]
Columns: [1,2,3]
[4,5,6]
df=pd.read_csv('header.csv')
df1 = pd.read_csv('axis.csv')
df2 = pd.concat ([df1, df2])
Ideal
a,b,c
1,2,3
4,5,6
Reality
1, 2, 3, a, b, c
4,5,6
If one side is only a header, you can use columns instead.
import pandas as pd
df1 = pd.read_csv('header.csv', header=0)
df2 = pd.read_csv('axis.csv', header = None)
df2.columns = df1.columns
print(df2)
Output:
abc
0 1 2 3
1 4 5 6
546 Understanding How to Configure Google API Key
549 PHP ssh2_scp_send fails to send files as intended
537 Uncaught (inpromise) Error on Electron: An object could not be cloned
542 Unable to install versioned in Google Colab
548 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
© 2024 OneMinuteCode. All rights reserved.