Skip to content
This repository has been archived by the owner on May 3, 2020. It is now read-only.

graphs don't automatically change to line-graphs when index is a datetime object #19

Closed
4n4nd opened this issue Aug 12, 2019 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@4n4nd
Copy link

4n4nd commented Aug 12, 2019

Describe the bug
graphs don't automatically change to line-graphs when index is a datetime object

To Reproduce
Steps to reproduce the behavior:

Run the following code in a notebook cell

import pandas as pd
import datetime
# sample time-series data
my_data = [[datetime.datetime(2019, 8, 12, 18, 22, 10, 542999), 8.55206], [datetime.datetime(2019, 8, 12, 18, 23, 10, 542999), 8.552038], [datetime.datetime(2019, 8, 12, 18, 24, 10, 542999), 8.552016], [datetime.datetime(2019, 8, 12, 18, 25, 10, 542999), 8.551991], [datetime.datetime(2019, 8, 12, 18, 26, 10, 542999), 8.551966], [datetime.datetime(2019, 8, 12, 18, 27, 10, 543999), 8.551938], [datetime.datetime(2019, 8, 12, 18, 28, 10, 542999), 8.551909], [datetime.datetime(2019, 8, 12, 18, 29, 10, 542999), 8.551879], [datetime.datetime(2019, 8, 12, 18, 30, 10, 542999), 8.551847]]
print(my_data)

# create dataframe with datetime index
my_df = pd.DataFrame(my_data, columns=["ds","y"]).set_index("ds")
my_df

Expected behavior
The plotted graphs to be line graphs instead of bar graphs

Version info:
jupyter_datatables.__version__=0.3.1

@4n4nd 4n4nd added the bug Something isn't working label Aug 12, 2019
@CermakM
Copy link
Owner

CermakM commented Aug 13, 2019

Hello and thank you for using the extension!

Care to elaborate why do you think this is a bug? From my perspective, this is the expected behaviour. The decision about the chart type is not made based on the index, but with regards to the dtype of the data column. Since you have a numerical column, it chooses the histogram by default.

Consider if you had for example strings or another kind of object which could not be turned into points ... then the line chart being the default for the datetime index would not make sense.

Cheers,
Marek

@4n4nd
Copy link
Author

4n4nd commented Aug 13, 2019

Oh I am sorry, I thought that's what you said during your presentation. I am probably mistaken then.

Thanks 👍

@4n4nd 4n4nd closed this as completed Aug 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants