from google.colab import files
import io
import glob
import pandas as pd

# Upload files from local machine to Colab
uploaded_files = files.upload()

# Specify folder as file_path, make sure all the logs are in the folder
# Assuming the folder structure is maintained in the uploaded files
file_paths = list(uploaded_files.keys())

# Create a list of DataFrames from uploaded files
dataframes = [pd.read_csv(io.StringIO(uploaded_files[file].decode('utf-8'))) if file.endswith(".csv") else pd.read_excel(io.BytesIO(uploaded_files[file])) for file in file_paths]

# Combine the DataFrames into a single DataFrame
combined_df = pd.concat(dataframes, ignore_index=True)

# Now you can use 'combined_df' for further analysis or processing

Naposledy změněno: pondělí, 4. března 2024, 16.56