1

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?

1

1 Answer 1

4
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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.