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

Wind class method from_csv does not automatically convert the index column to datetimes #178

Open
Tom-Kingstone opened this issue Mar 13, 2024 · 0 comments
Assignees
Labels
type:bug Error or unexpected behaviour type:user-experience Issues and changes relating to improving the overall User Experience (UX) of the tools

Comments

@Tom-Kingstone
Copy link
Contributor

Description:

When instantiating a Wind class from a csv file with time stamps, speeds and directions, a ValueError is raised when giving all required parameters (the csv path, the column for wind speed, and the column for wind direction). The method assumes that the first column in the csv is the index column, but it does not convert the index column to type DateTimeIndex instead, the user has to know that the method is using pd.read_csv with kwargs, and pass those kwargs into the from_csv method. This has extremely bad UX, as most users will not know this, and run into a ValueError (never mind that type(pd.DatetimeIndex) returns abc.ABCMeta further increasing confusion).

Steps to reproduce:

Try to create a Wind object from a csv only passing required positional arguments.

Expected behaviour:

As the method calls cls.from_dataframe() with the df read from the csv directly, and that method requires the dataframe to have a date time column, the method should do the conversion itself.

Also, the errors raised in from_dataframe should be TypeError when asserting types, rather than ValueError

Test file(s):

@Tom-Kingstone Tom-Kingstone added the type:bug Error or unexpected behaviour label Mar 13, 2024
@Tom-Kingstone Tom-Kingstone added the type:user-experience Issues and changes relating to improving the overall User Experience (UX) of the tools label Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Error or unexpected behaviour type:user-experience Issues and changes relating to improving the overall User Experience (UX) of the tools
Projects
None yet
Development

No branches or pull requests

2 participants