You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.rst
+6-2
Original file line number
Diff line number
Diff line change
@@ -330,7 +330,7 @@ Hello World, and Basic Usage
330
330
my_chart.options.credits = my_credits
331
331
332
332
# EXAMPLE 3.
333
-
# Pandas with timeseries
333
+
# Pandas with time series
334
334
import pandas as pd
335
335
import datetime as dt
336
336
import numpy as np
@@ -344,7 +344,11 @@ Hello World, and Basic Usage
344
344
345
345
df['ref_date'] = pd.to_datetime(df['ref_date'])
346
346
df.set_index('ref_date', inplace=True)
347
-
df.index = (df.index.astype(np.int64) /10**6).astype(np.int64) # Correcting nanoseconds to epoch, this is crucial for javascript rendering, check https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/now for more information on this behaviour
and try playing with your browser console with a command like ``Date.now();``. You should see a very large integer representing the number of nanoseconds elapsed since the first of January. 1970.
426
+
427
+
While Highcharts for Python will automatically convert NumPy `datetime64 <numpy:numpy.datetime64>` values into their
428
+
appropriate integers, you may want to do this conversion yourself. A demonstration is given below:
Normally, in the context of pandas one would reference their pandas DataFrame with the timeseries at the index.
504
-
505
-
Beware that javascript renders time through epoch, and so does the Highcharts javascript library, thus keep in mind this is a requirement!
506
-
507
-
For further read on the top, check the example under `Date.now() - JavaScript | MDN <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/now>`__,
508
-
also try playing with your browser console and use something like `Date.now();`, and you should see a very large int represeting the current time in epoch, meaning the time elapsed since 1970, January the first in nanoseconds.
0 commit comments