Issue with the datetime xaxis with a TimeSeries Chart

I am trying to make a Timeseries chart showing the price of a currency for each day for the last 15 years.

But the end result just a mess when there is ticker for each day for the given time period. Is there a quick fix to show just have a one item for each year in the x axis?

And secondly, I am trying to have just the year in the x axis instead of of the full date ( 2002 instead of 01/01/2002 for example), any easy way to achieve that?

Thanks.

A portion of my data:

Date
PX_LAST
01/01/2002
1.45
02/01/2002
1.447
03/01/2002
1.4225
04/01/2002
1.4175

import pandas as pd

from bokeh.charts import TimeSeries, show, output_file

from bokeh.models import FixedTicker

from bokeh.models import SingleIntervalTicker, LinearAxis

dosya = ("csv file’)

Csv read

USD = pd.read_csv(dosya, parse_dates=[‘Date’])

#data

data = dict(

USDTRY=USD['PX_LAST'],

Date=USD['Date'],

)

p = TimeSeries(data,

                x='Date', y=['USDTRY'],

                color=['USDTRY'], dash=['USDTRY'],

                title="Timeseries", ylabel='Historical USDTRY', legend=True)

output_file(“timeseries.html”)

show§

``

TimeSeries works if ‘Date’ is the index:

USD = pd.read_csv( dosya, parse_dates=[‘Date’], index_col=[‘Date’])

p = TimeSeries( USD, …

Should work.

···

On Saturday, April 15, 2017 at 6:52:28 PM UTC+2, firat wrote:

I am trying to make a Timeseries chart showing the price of a currency for each day for the last 15 years.

But the end result just a mess when there is ticker for each day for the given time period. Is there a quick fix to show just have a one item for each year in the x axis?

And secondly, I am trying to have just the year in the x axis instead of of the full date ( 2002 instead of 01/01/2002 for example), any easy way to achieve that?

Thanks.

A portion of my data:

Date
PX_LAST
01/01/2002
1.45
02/01/2002
1.447
03/01/2002
1.4225
04/01/2002
1.4175

import pandas as pd

from bokeh.charts import TimeSeries, show, output_file

from bokeh.models import FixedTicker

from bokeh.models import SingleIntervalTicker, LinearAxis

dosya = ("csv file’)

Csv read

USD = pd.read_csv(dosya, parse_dates=[‘Date’])

#data

data = dict(

USDTRY=USD['PX_LAST'],
Date=USD['Date'],

)

p = TimeSeries(data,

                x='Date', y=['USDTRY'],
                color=['USDTRY'], dash=['USDTRY'],
                title="Timeseries", ylabel='Historical USDTRY', legend=True)

output_file(“timeseries.html”)

show§

``

Thanks for your reply but outcome is exactly the same.

TimeSeries is working **the problem is x axis is too crowded as there is a data point for each day in the last 15 years. **

···

On Sunday, April 16, 2017 at 12:01:27 AM UTC+3, alEx S wrote:

TimeSeries works if ‘Date’ is the index:

USD = pd.read_csv( dosya, parse_dates=[‘Date’], index_col=[‘Date’])

p = TimeSeries( USD, …

Should work.

On Saturday, April 15, 2017 at 6:52:28 PM UTC+2, firat wrote:

I am trying to make a Timeseries chart showing the price of a currency for each day for the last 15 years.

But the end result just a mess when there is ticker for each day for the given time period. Is there a quick fix to show just have a one item for each year in the x axis?

And secondly, I am trying to have just the year in the x axis instead of of the full date ( 2002 instead of 01/01/2002 for example), any easy way to achieve that?

Thanks.

A portion of my data:

Date
PX_LAST
01/01/2002
1.45
02/01/2002
1.447
03/01/2002
1.4225
04/01/2002
1.4175

import pandas as pd

from bokeh.charts import TimeSeries, show, output_file

from bokeh.models import FixedTicker

from bokeh.models import SingleIntervalTicker, LinearAxis

dosya = ("csv file’)

Csv read

USD = pd.read_csv(dosya, parse_dates=[‘Date’])

#data

data = dict(

USDTRY=USD['PX_LAST'],
Date=USD['Date'],

)

p = TimeSeries(data,

                x='Date', y=['USDTRY'],
                color=['USDTRY'], dash=['USDTRY'],
                title="Timeseries", ylabel='Historical USDTRY', legend=True)

output_file(“timeseries.html”)

show§

``

What is the limit bokeh behave normally ?
Have you tried to slice down your time serie: 5 years, 10 years and see when it breaks down ?

···

On Tue, May 9, 2017 at 3:28 PM firat [email protected] wrote:

Thanks for your reply but outcome is exactly the same.

TimeSeries is working **the problem is x axis is too crowded as there is a data point for each day in the last 15 years. **

On Sunday, April 16, 2017 at 12:01:27 AM UTC+3, alEx S wrote:

TimeSeries works if ‘Date’ is the index:

USD = pd.read_csv( dosya, parse_dates=[‘Date’], index_col=[‘Date’])

p = TimeSeries( USD, …

Should work.

On Saturday, April 15, 2017 at 6:52:28 PM UTC+2, firat wrote:

I am trying to make a Timeseries chart showing the price of a currency for each day for the last 15 years.

But the end result just a mess when there is ticker for each day for the given time period. Is there a quick fix to show just have a one item for each year in the x axis?

And secondly, I am trying to have just the year in the x axis instead of of the full date ( 2002 instead of 01/01/2002 for example), any easy way to achieve that?

Thanks.

A portion of my data:

Date
PX_LAST
01/01/2002
1.45
02/01/2002
1.447
03/01/2002
1.4225
04/01/2002
1.4175

import pandas as pd

from bokeh.charts import TimeSeries, show, output_file

from bokeh.models import FixedTicker

from bokeh.models import SingleIntervalTicker, LinearAxis

dosya = ("csv file’)

Csv read

USD = pd.read_csv(dosya, parse_dates=[‘Date’])

#data

data = dict(

USDTRY=USD['PX_LAST'],
Date=USD['Date'],

)

p = TimeSeries(data,

                x='Date', y=['USDTRY'],
                color=['USDTRY'], dash=['USDTRY'],
                title="Timeseries", ylabel='Historical USDTRY', legend=True)

output_file(“timeseries.html”)

show§

``

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/ac2f79b3-92f5-4811-965b-60d14f44f711%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

I have accidentally sorted out the issue.

I don’t know how but when I sorted the dates in descending order the issue was resolved.

So instead of this :

Date
PX_LAST
01/01/2002
1.45
02/01/2002
1.447
03/01/2002
1.4225

I tried :

2002-01-03
1.4225
2002-01-02
1.447
2002-01-01
1.45
And it worked.

As far as I know using datasets with descending dates is not common practice.

It might be a good idea to put a disclaimer in TimeSeries tutorial about this issue maybe?

···

On Tuesday, May 9, 2017 at 6:15:14 PM UTC+3, alEx S wrote:

What is the limit bokeh behave normally ?
Have you tried to slice down your time serie: 5 years, 10 years and see when it breaks down ?

On Tue, May 9, 2017 at 3:28 PM firat [email protected] wrote:

Thanks for your reply but outcome is exactly the same.

TimeSeries is working **the problem is x axis is too crowded as there is a data point for each day in the last 15 years. **

On Sunday, April 16, 2017 at 12:01:27 AM UTC+3, alEx S wrote:

TimeSeries works if ‘Date’ is the index:

USD = pd.read_csv( dosya, parse_dates=[‘Date’], index_col=[‘Date’])

p = TimeSeries( USD, …

Should work.

On Saturday, April 15, 2017 at 6:52:28 PM UTC+2, firat wrote:

I am trying to make a Timeseries chart showing the price of a currency for each day for the last 15 years.

But the end result just a mess when there is ticker for each day for the given time period. Is there a quick fix to show just have a one item for each year in the x axis?

And secondly, I am trying to have just the year in the x axis instead of of the full date ( 2002 instead of 01/01/2002 for example), any easy way to achieve that?

Thanks.

A portion of my data:

Date
PX_LAST
01/01/2002
1.45
02/01/2002
1.447
03/01/2002
1.4225
04/01/2002
1.4175

import pandas as pd

from bokeh.charts import TimeSeries, show, output_file

from bokeh.models import FixedTicker

from bokeh.models import SingleIntervalTicker, LinearAxis

dosya = ("csv file’)

Csv read

USD = pd.read_csv(dosya, parse_dates=[‘Date’])

#data

data = dict(

USDTRY=USD['PX_LAST'],
Date=USD['Date'],

)

p = TimeSeries(data,

                x='Date', y=['USDTRY'],
                color=['USDTRY'], dash=['USDTRY'],
                title="Timeseries", ylabel='Historical USDTRY', legend=True)

output_file(“timeseries.html”)

show§

``

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/ac2f79b3-92f5-4811-965b-60d14f44f711%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.