Skip to content
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

PerspectiveWidget Doesn't Respect Pandas Datatype datetime64[ns] and others #2124

Closed
tlmille2 opened this issue Mar 26, 2021 · 0 comments · Fixed by #2130
Closed

PerspectiveWidget Doesn't Respect Pandas Datatype datetime64[ns] and others #2124

tlmille2 opened this issue Mar 26, 2021 · 0 comments · Fixed by #2130
Milestone

Comments

@tlmille2
Copy link

Overview

I've noticed the PerspectiveWidget doesn't respect Pandas Datatype datetime64[ns] . For example, if a pandas dataframe contains a datetime64[ns] value, the PerspectiveWidget will display the column as a unix timestamp.
image

Expected Behavior

The PerspectiveWidget returns a datetime value instead of a unix timestamp
image

Example Working Solution Using Perspective natively

import pandas as pd
import numpy as np
from datetime import date, datetime
from perspective import PerspectiveWidget

data = pd.DataFrame({
    "int": np.arange(100),
    "float": [i * 1.5 for i in range(100)],
    "bool": [True for i in range(100)],
    "date": [date.today() for i in range(100)],
    "datetime": [datetime.now() for i in range(100)],
    "string": [str(i) for i in range(100)]
})

widget = PerspectiveWidget(data, filters=[["set", "==", True]])

Example Bug Using Panel/Lumen

import holoviews as hv
import panel as pn
import pandas as pd
import numpy as np
from datetime import date, datetime
pn.extension('perspective')

data = pd.DataFrame({
    "int": np.arange(100),
    "float": [i * 1.5 for i in range(100)],
    "bool": [True for i in range(100)],
    "date": [date.today() for i in range(100)],
    "datetime": [datetime.now() for i in range(100)],
    "string": [str(i) for i in range(100)]
})

pn.pane.Perspective(
    data, sizing_mode='stretch_width', height=400
)

image

@philippjfr philippjfr added this to the v0.11.2 milestone Mar 29, 2021
@philippjfr philippjfr modified the milestones: v0.11.2, v0.11.3 Apr 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants