-
Notifications
You must be signed in to change notification settings - Fork 3
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
Cannot convert Neware files from .xlsx and .csv to .parquet #139
Comments
Hi, sorry for the delay in getting back to you. Could you share the headings of your Neware results file? It looks like the importer is looking for some that are not present. |
No worries, here are the headings for the 'record' sheet. Let me know if you need any further info :) |
Hi James, (yes I guessed it might be you!) Okay so the first issue is that it is requiring "Date" as a column. This was because Neware seems to have issues keeping track of time, so I found its "Date" to be more reliable than the Time column. This is an easy thing to fix so I can do that quickly and push. The other issue is that it is looking for |
Hi @DrIVIinotaur, I've made some updates to the Would you mind testing it on your files before I merge my changes into the main branch? You'll need to do the following:
git fetch
git checkout add-more-cyclers
pip install . Then just continue as you were working before. If you have any issues, just let me know. |
Hi Tom,
Looks like PyProBE is searching for 'Step' and not 'Step Type' For XLSX files I am getting the following:
Possibly another different header? Using 'Current' instead of 'Current(A)'? |
Hi James, Okay so the "Step" error might be a bit more fundamental. Unfortunately having a "Step" column is pretty fundamental to the way that PyProBE operates. I think in Neware "Step Type" is a description of the step i.e. "Charge", "Discharge" etc. so isn't a substitute for a numerical index that PyProBE checks against your readme file. If you could re-export the data to include a "Step" column that would be ideal, otherwise you might be able to manually add it with a separate script based on the changes in the "Step Type" column. As for the error with "Current", it should be looking for Current(A), so I'm not sure why it's struggling. I have an open issue to improve the error messaging for this import process, so it's clearer what it causing these issues. I'll try to do this soon and push to this branch. |
Attempted to run this code to convert .xlsx (and .csv) files to .parquet files from raw Neware data:
However I am faced with one of two errors depending on whether I am converting .xlsx or .csv.
XLSX:
Traceback (most recent call last): File "C:\Users\wo22965\OneDrive - University of Bristol\Documents\GitHub\SpiderMan\Garfield.py", line 11, in <module> newcell.process_cycler_file(cycler='neware', File "C:\Users\wo22965\OneDrive - University of Bristol\Documents\GitHub\SpiderMan\venv\Lib\site-packages\pydantic\validate_call_decorator.py", line 60, in wrapper_function return validate_call_wrapper(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\wo22965\OneDrive - University of Bristol\Documents\GitHub\SpiderMan\venv\Lib\site-packages\pydantic\_internal\_validate_call.py", line 96, in __call__ res = self.__pydantic_validator__.validate_python(pydantic_core.ArgsKwargs(args, kwargs)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\wo22965\OneDrive - University of Bristol\Documents\GitHub\SpiderMan\venv\Lib\site-packages\pyprobe\cell.py", line 104, in process_cycler_file self._write_parquet(importer, output_data_path) File "C:\Users\wo22965\OneDrive - University of Bristol\Documents\GitHub\SpiderMan\venv\Lib\site-packages\pyprobe\cell.py", line 230, in _write_parquet dataframe = importer.pyprobe_dataframe ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\wo22965\OneDrive - University of Bristol\Documents\GitHub\SpiderMan\venv\Lib\site-packages\pyprobe\cyclers\basecycler.py", line 174, in pyprobe_dataframe self.time, ^^^^^^^^^ File "C:\Users\wo22965\OneDrive - University of Bristol\Documents\GitHub\SpiderMan\venv\Lib\site-packages\pyprobe\cyclers\neware.py", line 32, in time self._imported_dataframe.columns.index("Date") ValueError: 'Date' is not in list
CSV:
C:\Users\wo22965\OneDrive - University of Bristol\Documents\GitHub\SpiderMan\venv\Lib\site-packages\pyprobe\cyclers\neware.py:31: PerformanceWarning: Determining the data types of a LazyFrame requires resolving its schema, which is a potentially expensive operation. Use
LazyFrame.collect_schema().dtypes()to get the data types without this warning. self._imported_dataframe.dtypes[ C:\Users\wo22965\OneDrive - University of Bristol\Documents\GitHub\SpiderMan\venv\Lib\site-packages\pyprobe\cyclers\neware.py:32: PerformanceWarning: Determining the column names of a LazyFrame requires resolving its schema, which is a potentially expensive operation. Use
LazyFrame.collect_schema().names()to get the column names without this warning. self._imported_dataframe.columns.index("Date") Traceback (most recent call last): File "C:\Users\wo22965\OneDrive - University of Bristol\Documents\GitHub\SpiderMan\Garfield.py", line 11, in <module> newcell.process_cycler_file(cycler='neware', File "C:\Users\wo22965\OneDrive - University of Bristol\Documents\GitHub\SpiderMan\venv\Lib\site-packages\pydantic\validate_call_decorator.py", line 60, in wrapper_function return validate_call_wrapper(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\wo22965\OneDrive - University of Bristol\Documents\GitHub\SpiderMan\venv\Lib\site-packages\pydantic\_internal\_validate_call.py", line 96, in __call__ res = self.__pydantic_validator__.validate_python(pydantic_core.ArgsKwargs(args, kwargs)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\wo22965\OneDrive - University of Bristol\Documents\GitHub\SpiderMan\venv\Lib\site-packages\pyprobe\cell.py", line 104, in process_cycler_file self._write_parquet(importer, output_data_path) File "C:\Users\wo22965\OneDrive - University of Bristol\Documents\GitHub\SpiderMan\venv\Lib\site-packages\pyprobe\cell.py", line 230, in _write_parquet dataframe = importer.pyprobe_dataframe ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\wo22965\OneDrive - University of Bristol\Documents\GitHub\SpiderMan\venv\Lib\site-packages\pyprobe\cyclers\basecycler.py", line 180, in pyprobe_dataframe self.capacity, ^^^^^^^^^^^^^ File "C:\Users\wo22965\OneDrive - University of Bristol\Documents\GitHub\SpiderMan\venv\Lib\site-packages\pyprobe\cyclers\basecycler.py", line 284, in capacity return self.capacity_from_ch_dch ^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\wo22965\OneDrive - University of Bristol\Documents\GitHub\SpiderMan\venv\Lib\site-packages\pyprobe\cyclers\basecycler.py", line 259, in capacity_from_ch_dch self.charge_capacity.diff().clip(lower_bound=0).fill_null(strategy="zero") ^^^^^^^^^^^^^^^^^^^^ File "C:\Users\wo22965\OneDrive - University of Bristol\Documents\GitHub\SpiderMan\venv\Lib\site-packages\pyprobe\cyclers\basecycler.py", line 237, in charge_capacity "Charge Capacity", self._column_map["Charge Capacity"]["Unit"] ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^ KeyError: 'Charge Capacity'
Please help :)
The text was updated successfully, but these errors were encountered: