Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in sample script #5

Open
emilydoherty opened this issue Jul 3, 2023 · 8 comments
Open

Error in sample script #5

emilydoherty opened this issue Jul 3, 2023 · 8 comments
Assignees

Comments

@emilydoherty
Copy link

Where the compiled dataset will be stored

DATASET_POSTPROCESSED_FILENAME = gen_path_temp("Dataset_CEAP", extension=".csv")

Load or create dataframe with statistics of initial dataset

df_ceap = None
try:
df_ceap = pd.read_csv(DATASET_POSTPROCESSED_FILENAME)
print("Data loaded from file")
except:
print("Creating file")
# Load all data resampled by frame
for pid in PARTICIPANTS_IDS: # Which participants to load
for dttype in DATA_GROUPS: # Which data type to load
for prep in ["Frame"]: # Which processing level
df_single_file = data_manager.load_data_from_participant(pid, dttype, prep, clean_physio=True)
df_ceap = df_single_file if (df_ceap is None) else pd.concat([df_ceap, df_single_file], axis=0)

# Saving .csv
df_ceap.to_csv(DATASET_POSTPROCESSED_FILENAME, index=False)

print(f"\n\tFinished creating files {DATASET_POSTPROCESSED_FILENAME}")`

Getting the following error:

FileNotFoundError Traceback (most recent call last)
Cell In[23], line 6
5 try:
----> 6 df_ceap = pd.read_csv(DATASET_POSTPROCESSED_FILENAME)
7 print("Data loaded from file")

File /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pandas/io/parsers/readers.py:912, in read_csv(filepath_or_buffer, sep, delimiter, header, names, index_col, usecols, dtype, engine, converters, true_values, false_values, skipinitialspace, skiprows, skipfooter, nrows, na_values, keep_default_na, na_filter, verbose, skip_blank_lines, parse_dates, infer_datetime_format, keep_date_col, date_parser, date_format, dayfirst, cache_dates, iterator, chunksize, compression, thousands, decimal, lineterminator, quotechar, quoting, doublequote, escapechar, comment, encoding, encoding_errors, dialect, on_bad_lines, delim_whitespace, low_memory, memory_map, float_precision, storage_options, dtype_backend)
910 kwds.update(kwds_defaults)
--> 912 return _read(filepath_or_buffer, kwds)

File /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pandas/io/parsers/readers.py:577, in _read(filepath_or_buffer, kwds)
576 # Create the parser.
--> 577 parser = TextFileReader(filepath_or_buffer, **kwds)
579 if chunksize or iterator:

File /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pandas/io/parsers/readers.py:1407, in TextFileReader.init(self, f, engine, **kwds)
1406 self.handles: IOHandles | None = None
-> 1407 self._engine = self._make_engine(f, self.engine)

File /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pandas/io/parsers/readers.py:1661, in TextFileReader._make_engine(self, f, engine)
1660 mode += "b"
-> 1661 self.handles = get_handle(
1662 f,
1663 mode,
...
2627 raise TypeError(
2628 "Passing a dict as an indexer is not supported. Use a list instead."
2629 )

TypeError: Passing a set as an indexer is not supported. Use a list instead.
Output is truncated. View as a scrollable element or open in a text editor. Adjust cell output settings...

@TongXueBIT
Copy link
Contributor

Sorry, I don't understand this issue. the data format in CEAP-360VR dataset is json, but it seems your code loaded csv file. I am not sure how you did this conversion.

@emilydoherty
Copy link
Author

Hello, I am simply trying to run the sample Jupyter notebook in the Scripts folder and am receiving this error. Can you advise? Many thanks.

@emilydoherty
Copy link
Author

Hello, are you able to help with error in the sample script? Thank you.

@abdoelali
Copy link
Contributor

@luisqtr seems this issue may be due to the Jupyter notebook you created -- would you help resolve this? Thanks!

@luisqtr
Copy link
Contributor

luisqtr commented Jul 10, 2023

Hi @emilydoherty.

Thanks for reporting the error. Apparently it is an incompatibility between pandas v2.0 (which I assume you are using in Python 3.11), and pandas v1.5.2 used to create the library back then. I fixed and tested in pandas 2.0.3, we should wait for @abdoelali to accept the pull request in the main repo or otherwise you can download it from my fork. Let us know if you still have errors after running the latest version.

In case you need the .CSV right away, you can download them from this link and extract the .zip in the path: CEAP-360VR-Dataset/CEAP-360VR/6_Scripts/4_Example Jupyter Notebook/ so that it creates .../4_Example Jupyter Notebook/temp/ceap_example/Dataset_CEAP.csv

@emilydoherty
Copy link
Author

Thanks very much for your quick reply! I will use the .csv. Thanks again.

@emilydoherty
Copy link
Author

One more question: do you have the .csv files resulting from the baseline scripts? I'm specifically looking for the .csv with features extracted for ML purposes. I'm running into several errors when trying to run the scripts. Many thanks.

@luisqtr
Copy link
Contributor

luisqtr commented Jul 18, 2023

Do you mean the file Dataset_CEAP_postprocessed.csv inside the zip file that I shared in the link above or another CSV file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants