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
Currently, loading data from pandas DataFrames seems to be problematic as pandas uses numpy.int64 types, which apparently (?) aren't fully supported by python-nvd3 when displayed in IPython. It would be great if this was natively supported, so one could take data directly from the pandas DataFrame without converting back to long/int.
For example:
# This demo requires the installation of the python-nvd3 module.
# This can be downloaded from https://github.com/areski/python-nvd3 (the zip on the right)
# and installed via "pip install path_to_zip".
import random
from IPython import display as d
import nvd3
nvd3.ipynb.initialize_javascript(use_remote=True)
import numpy as np
import pandas as pd
df = pd.DataFrame({'x': range(nb_element), 'y': [i * random.randint(1, 10) for i in range(nb_element)]})
chart3=nvd3.lineWithFocusChart(name="focusChart",height=450)
nb_element = 100
xdata = list(df['x'].values)
ydata = list(df['y'].values)
chart3.add_serie(x=xdata,y=ydata,name="random data")
chart3
yields "<nvd3.lineWithFocusChart.lineWithFocusChart instance at 0x0000000008BDE988>", while
# This demo requires the installation of the python-nvd3 module.
# This can be downloaded from https://github.com/areski/python-nvd3 (the zip on the right)
# and installed via "pip install path_to_zip".
import random
from IPython import display as d
import nvd3
nvd3.ipynb.initialize_javascript(use_remote=True)
import numpy as np
import pandas as pd
df = pd.DataFrame({'x': range(nb_element), 'y': [i * random.randint(1, 10) for i in range(nb_element)]})
chart3=nvd3.lineWithFocusChart(name="focusChart",height=450)
nb_element = 100
xdata = list(long(x) for x in df['x'].values)
ydata = list(long(x) for x in df['y'].values)
chart3.add_serie(x=xdata,y=ydata,name="random data")
chart3
yields the correct graph displayed inline in IPython notebook.
The text was updated successfully, but these errors were encountered:
Currently, loading data from pandas DataFrames seems to be problematic as pandas uses numpy.int64 types, which apparently (?) aren't fully supported by python-nvd3 when displayed in IPython. It would be great if this was natively supported, so one could take data directly from the pandas DataFrame without converting back to long/int.
For example:
yields "<nvd3.lineWithFocusChart.lineWithFocusChart instance at 0x0000000008BDE988>", while
yields the correct graph displayed inline in IPython notebook.
The text was updated successfully, but these errors were encountered: