0

I have two CSV files. They actually have over 2 million records in each, but here's a simplified version:

File 1 :

col1
----
1
54
744
45
65

File 2 :

col2
----
sdf
322
d3
d
2

What is the quickest way of combining the two of these to end up with the following?

col1  |  col2
-------------
1     |  sdf
54    |  322
744   |  d3
45    |  d
65    |  2

I would usually use Excel or similar but the dataset is too large to load. Is there something in Pandas I can use to achieve this?

thanksd
  • 54,176
  • 22
  • 157
  • 150
fightstarr20
  • 11,682
  • 40
  • 154
  • 278
  • http://stackoverflow.com/questions/10545957/creating-pandas-data-frame-from-multiple-files – Dadep Apr 10 '17 at 21:41

1 Answers1

3
import pandas as pd
df1 = pd.read_csv("csv1")
df2 = pd.read_csv("csv2")

result = pd.concat([df1, df2], axis=1)

This should do the trick

Stephen Kaiser
  • 113
  • 1
  • 7