GUVI
Back

DOUBT IN FDS#113 STACKED BAR PLOT 

Created 3 years ago
46 Views
0 Comments
rohitumadi
@rohitumadi
rohitumadi
@rohitumadiProfile is locked. Login

in the module FDS#113 stacked bar plot

while I am executing the code FOR STACKED BAR PLOT

import numpy as np

import pandas as pd

import matplotlib.pyplot as plt

import seaborn as sns

import urllib.request

import json

#STACKED BAR PLOT

df=pd.read_json("data.json")

with open("data.json") as f:

data=json.load(f)

data=data["states_daily"]

df=pd.json_normalize(data)

df=df.tail(3)

df.drop('date',axis=1,inplace=True)

df.drop('dateymd',axis=1,inplace=True)

df.drop('tt',axis=1,inplace=True)

df.set_index('status',inplace=True)

df=df.T#states on rows on decesed ,recovered ,confirmed in cols

df.apply(pd.to_numeric)

#plt.bar(df.index,df.Confirmed)

plt.bar(df.index,df.Deceased,bottom=df.Confirmed+df.Recovered)

plt.xticks(rotation=90)

I am getting an error =only size-1 arrays can be converted to Python scalars

PLEASE HELP

Comments
Please login to comment.
 
Powered by habitate.io Habitate