Skip to content

Support for DataFrame Periods definition #3708

@mattijn

Description

@mattijn

What is your suggestion?

Include support for type Period. A period represents neither the start or the end of the period, but rather the entire period itself.

Given the following:

import altair as alt
import pandas as pd

df = pd.DataFrame(data={'year':pd.period_range(start=2020, end=2024, freq='Y'), 'values': range(0,5)})
df

Image

If I do:

alt.Chart(df).mark_bar().encode(x='year', y='values')

I receive the following error

TypeError: Object of type Period is not JSON serializable
alt.Chart(...)

Have you considered any alternative solutions?

Potential solution (?) for #1365 and #3701 (comment)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions