Search code examples
pythonpandasanalytics

Merge two files in Python PANDAS?


I have two files from where I need to fetch information for data analysis. I am using Python Pandas for this. Any help on how to do this will be appreciated.

I already know how merge 2 files using Python - I am looking forward to achieve this job in PANDAS particularly.

Once 2 files merged then I need to get some analytical data out of it. Both these file do have same structure of data in CSV format.


Solution

  • I would suggest to read the csv files into dataframes and concatenate them this way

    frames = [pd.read_csv('f1.csv'), pd.read_csv('f2.csv')]
    result = concat(frames,ignore_index=True)