Wind class method from_csv
does not automatically convert the index column to datetimes
#178
Labels
type:bug
Error or unexpected behaviour
type:user-experience
Issues and changes relating to improving the overall User Experience (UX) of the tools
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 thattype(pd.DatetimeIndex)
returnsabc.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 beTypeError
when asserting types, rather thanValueError
Test file(s):
The text was updated successfully, but these errors were encountered: