aeye-lab / pymovements

A python package for processing eye movement data
https://pymovements.readthedocs.io
MIT License
57 stars 11 forks source link

raise more helpful warning if columns have wrong type #595

Open dkrako opened 9 months ago

dkrako commented 9 months ago

Description of the problem

the error message that we get in #517 could be more helpful to users that are not experienced with polars.

exceptions.ComputeError: arithmetic on string and numeric not allowed, try an explicit cast first

Description of a solution

We could instead catch that exception and return a new one.

We should discuss if the new exception should have the same type (polars.ComputeError) or have a new type (in pymovements.exceptions). A more helpful error message should then include the name of the column, the transformation method, the actual and the expected type, and should point to datatype casting the particular column or specifying the schema, either in one of the file loading functions like from_csv() or in a dataset definition.

Minimum acceptance criteria