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
I have the below loop, I would like it to save all the dataframes into a csv as it loops but it only save the last loop. I am a newbee please advise where am I going wrong.
inverterdata=[]
for i in invertersinfo.items():
inverterdata.append([i[0],i[1]])
invdata=pd.DataFrame(inverterdata)
data = pd.json_normalize(json.loads(invdata.to_json(orient="records")))
hh=data.explode('1.telemetries')
data2 = pd.json_normalize(json.loads(hh.to_json(orient="records")))
data2 = data2.drop(['1.count', '0'], axis=1)
data2.columns = [col.replace('1.telemetries.', '') for col in data2.columns]
data2.columns += "_"+ name
data2.to_csv("Samapledata.csv", index=False).
The text was updated successfully, but these errors were encountered:
I have the below loop, I would like it to save all the dataframes into a csv as it loops but it only save the last loop. I am a newbee please advise where am I going wrong.
inverterdata=[]
for i in invertersinfo.items():
inverterdata.append([i[0],i[1]])
data2.to_csv("Samapledata.csv", index=False).
The text was updated successfully, but these errors were encountered: