Hello,
I just started with plot.ly two days ago, so I apologize my limited knowledge of the software.
I wrote some that create an array of dataframes that I need to plot. I manged to have multiple plots on matplotlib and can create a single plot on plot.ly. My main problem multiple lots using a for loop.
M code :
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import plotly.graph_objects as go
dfc = {} # Create an arrray, and in this case an array of dataframes
meterNumber = df.iloc[:,0].unique() # Finds all the meternumbers in the column
for x in range(len(meterNumber)): #Iterate through meterNumber
dfc[x] = df[df.iloc[:,0]== meterNumber[x]] # Create new dataframes
#for x in range(len(meterNumber)): #previous cde
dfc[x].plot.bar()
for i in range(len(meterNumber)):
fig[i] = go.Figure([go.Bar(x=df.columns, y=dfc[i])])
The error:
AttributeError Traceback (most recent call last)
in
17
18 for i in range(len(meterNumber)):
β> 19 fig[i] = go.Figure([go.Bar(x=df.columns, y=dfc[i])])
~/Downloads/Desktop/lib/python3.7/site-packages/plotly/basedatatypes.py in setitem(self, prop, value)
299 # Convert into a property tuple
300 orig_prop = prop
β> 301 prop = BaseFigure._str_to_dict_path(prop)
302
303 # Handle empty case
~/Downloads/Desktop/lib/python3.7/site-packages/plotly/basedatatypes.py in _str_to_dict_path(key_path_str)
1211 # Split string on periods.
1212 # e.g. βfoo.bar_baz[1]β -> [βfooβ, βbar_baz[1]β]
-> 1213 key_path = key_path_str.split(".")
1214
1215 # Split out bracket indexes.
AttributeError: βintβ object has no attribute βsplitβ
I am lost in this portion.
Than you fr the help