Я могу читать по одному файлу за раз, используя аналогичный подход.
Это ресурс по bioread< /код>.
Код: Выделить всё
import pandas as pd
from bioread import read_file
# Specify the folder containing your Acq files
folder_path = r"C:\path\to\your\acq_files"
# Initialize empty lists for EDA and ECG data
eda_data = []
ecg_data = []
# Iterate through Acq files in the folder
for file_name in os.listdir(folder_path):
if file_name.endswith(".acq"):
file_path = os.path.join(folder_path, file_name)
# Read the Acq file
acq_data = read_file(file_path)
# Extract data for EDA channel
eda_channel_name = 'GSR - EDA100C'
if eda_channel_name in acq_data.channels:
eda_data.extend(acq_data[eda_channel_name].data.tolist())
# Extract data for ECG channel
ecg_channel_name = 'ECG - ECG100C'
if ecg_channel_name in acq_data.channels:
ecg_data.extend(acq_data[ecg_channel_name].data.tolist())
# Create DataFrames for EDA and ECG
df_eda = pd.DataFrame({"GSR - EDA100C": eda_data})
df_ecg = pd.DataFrame({"ECG - ECG100C": ecg_data})
# Print the first 10 rows of the EDA DataFrame
print("First 10 rows of the EDA DataFrame:")
print(df_eda.head(10))
# Print the first 10 rows of the ECG DataFrame
print("\nFirst 10 rows of the ECG DataFrame:")
print(df_ecg.head(10))
Код: Выделить всё
Empty DataFrame
Columns: []
Index: []
Подробнее здесь: https://stackoverflow.com/questions/777 ... ith-python