-
Notifications
You must be signed in to change notification settings - Fork 774
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
"TypeError: data type not understood" with dtype: period[M] #1931
Comments
The sanitization code needs to be updated to recognize period types. That said, Vega-Lite has no data type representing time periods, so I think the best possible outcome would probably be a more informative error. |
Hi Jake, any idea of when this issue will be resolved? Still getting the |
It will be resolved when someone fixes it. Are you interested? |
The relevant code that would need to be modified is here: https://github.com/altair-viz/altair/blob/03f37ca8b2701bf8d9e61646cacf8eee2edcad87/altair/utils/core.py#L243-L350 That said, it's unclear what is the best way to represent time periods in Vega-Lite, which doesn't have the concept of time periods. I suppose it could be represented as timestamps with respect to some standard start time, such as 2012-01-01 00:00:00 |
Quick question on this: how would you expect your period columns to be represented within the Vega-Lite chart? Should it be a timestamp? A string? Silently ignored? |
Hi Jake, "I suppose it could be represented as timestamps with respect to some standard start time, such as 2012-01-01 00:00:00" - that would be my thought. Could the sanitization code be used to convert periods into timestamps before they get passed to Vega-Lite? And say if PeriodIndex has the frequency of "M" (Monthly), perhaps there is an implicit conversion to 'month(period_column)' in the Altair code? Not sure what's the best way to do this second part. Alternately, the easy way out may be for the user to explicitly specify 'month(period_column)', knowing that the period_column has been cast to time_stamp through sanitization. Let me know your thoughts. Thank you. |
We don't have any mechanism at the moment for data sanitization to affect the encoding specification, and I think we should probably avoid making those kinds of assumptions for the user. Silent changes of defaultsthat are convenient in some situations often lead to a lot of confusion in others. |
Thanks for a great project! With these versions:
I get the following error when trying to pass a dataframe with a period to altair:
TypeError: data type not understood
The error disappears when the 'Sale month' column is not passed to altair.
The text was updated successfully, but these errors were encountered: