I have the following pandas Series
(which is actually the output of running value_counts()
on a certain column - "Tipo de vivienda" - of a DataFrame
:
With visualizaion libraries such as Seaborn, Bokeh etc. I can form a bar chart directly on this Series, without additional wrangling or conversion. Yet for d3py, bar charts can only be generated from DataFrames (I believe). So I convert the series to a DataFrame
:
I then set about plotting the bar chart:
p = d3py.PandasFigure(v_as_df)
At this point, I need to tell d3py that I want a Bar chart. I also need to tell it the titles of the columns, and this is where things fall down. Calling v_as_df.columns()
gives me:
Index([u'Tipo de vivienda'], dtype='object')
Somewhat guessing what the columns names are, I try:
p += d3py.Bar('', 'Tipo de vivienda') # x, y
... but nothing gets displayed when I call p.show()
, and I am guessing it's because I don't have a true DataFrame
, but rather a Series
casted as such.
Is calling DataFrame()
on the Series
the wrong way to go?
- Python: 2.7.11
- pandas: 0.18.0