-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Allow serialization overwrite, or different serialization on specific component/props #4058
Comments
Why is not possible to use the value of the current serializer of dataframe? |
I wrapped altair/vega component here But vega-lite/vega needs data like this : df.to_dict("records")
[
{'date': Timestamp('2012-01-01 00:00:00'),
'precipitation': 0.0,
'temp_max': 12.8,
'temp_min': 5.0,
'weather': 'drizzle',
'wind': 4.7},
{'date': Timestamp('2012-01-02 00:00:00'),
'precipitation': 10.9,
'temp_max': 10.6,
'temp_min': 2.8,
'weather': 'rain',
'wind': 4.5}
] instead of df.to_dict()
{'date': {0: Timestamp('2012-01-01 00:00:00'),
1: Timestamp('2012-01-02 00:00:00')},
'precipitation': {0: 0.0, 1: 10.9},
'temp_max': {0: 12.8, 1: 10.6},
'temp_min': {0: 5.0, 1: 2.8},
'weather': {0: 'drizzle', 1: 'rain'},
'wind': {0: 4.7, 1: 4.5}} Its not a major issue, just for convenience |
What do you think of something like : DataFrameAltair= Annotated[pd.DataFrame, {"orient": "records "}] And then in the serializer check for annotation ? |
Serializer is created, but not used :( |
dang it, that seemed like a good solution is it possible to wrap dataframe some other way? like with an actual type and not an alias |
Describe the bug
Can't overwrite an existing serializer for a defined type (here pd.DataFrame
To Reproduce
usage
In my vega/altair wrapper I need to serialize dataframe to
records
(list of dict[col, value]quickfix fail
But when app is starting, serializer is called with overwrite default value ! So False instaid of True !
The text was updated successfully, but these errors were encountered: