Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Plotting DataFrame with timedelta64 (y-axis) #801

Open
Labels
P3backlog featuresomething new
@s-celles

Description

Similar to #799 but on y-axis and pandas-dev/pandas#16953

import pandas as pd
from pandas.compat import StringIO
import plotly
import plotly.graph_objs as go
dat = """c1,c2,c3
1000,2000,1500
9000,8000,1600"""
df = pd.read_csv(StringIO(dat))
df = df.apply(lambda x: pd.to_timedelta(x, unit='ms'))
print(df)
print(df.dtypes)
print(df.index)
trace1 = go.Bar(
 x=df.index,
 y=df.c1,
 name='c1'
)
trace2 = go.Bar(
 x=df.index,
 y=df.c2,
 name='c2'
)
trace3 = go.Bar(
 x=df.index,
 y=df.c3,
 name='c3'
)
data = [trace1, trace2, trace3]
layout = go.Layout(
 barmode='group'
)
plotly.offline.plot({
"data": data,
"layout": layout
})

displays

capture d ecran 2017年07月22日 a 12 35 57

y-axis values are not correctly displayed

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3backlog featuresomething new

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /