Features/allow data heigts of type string#90
Conversation
| # Convert data heights to integer. In some case they are strings. | ||
| weather_df.columns = pd.MultiIndex.from_arrays([ | ||
| weather_df.columns.get_level_values(0), | ||
| weather_df.columns.get_level_values(1).astype(int)]) |
There was a problem hiding this comment.
Why int and not float type? In the provided example the values are integers but that shouldn't be a rule, right?
There was a problem hiding this comment.
In my opinion the inaccuracy of the model is higher than the decimal digit. Therefore I would always prefer integer.
But at them moment floats are allowed and it might be easier to allow floats than to forbid them and to explain why.
| weather_df.columns = pd.MultiIndex.from_arrays([ | ||
| weather_df.columns.get_level_values(0), | ||
| weather_df.columns.get_level_values(1).astype(int)]) |
There was a problem hiding this comment.
Maybe putting in a try statement and re-raising the error? In case someone passes in 80 m that cannot be converted to a number?
There was a problem hiding this comment.
For me the error message is quite clear. It also indicates the exact value that causes the problem. For us it would be more difficult to indicate the problematic value. We could add something like "The heights should be convertible to numeric." but it in my opinion the original message is better. We could also check the array and show all problematic values but I think it is not worth it.
Fix: #86
The
read_csv()function of pandas read column names as strings. In a weather file the second level of the columns are the data heights. These heights should be of type integer.With this PR these values are converted into integer values.