Untitled

 avatar
unknown
plain_text
2 years ago
694 B
5
Indexable
import pandas as pd

def load_csv_files(file1, file2):
    try:
        # Load the first CSV file
        df1 = pd.read_csv(file1)

        # Load the second CSV file
        df2 = pd.read_csv(file2)

        # Display the loaded data (optional)
        print("Data from", file1, ":\n", df1)
        print("\nData from", file2, ":\n", df2)

        return df1, df2

    except Exception as e:
        print("Error loading CSV files:", e)
        return None, None

# Specify the file names (adjust these according to your file names)
file1_name = "file1.csv"
file2_name = "file2.csv"

# Load CSV files
data_frame1, data_frame2 = load_csv_files(file1_name, file2_name)
Editor is loading...
Leave a Comment