Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

plotting a bar chart with pandas

df = pd.DataFrame({'lab':['A', 'B', 'C'], 'val':[10, 30, 20]})
ax = df.plot.bar(x='lab', y='val', rot=0)
Comment

python stacked bar chart from dataframe

speed = [0.1, 17.5, 40, 48, 52, 69, 88]
>>> lifespan = [2, 8, 70, 1.5, 25, 12, 28]
>>> index = ['snail', 'pig', 'elephant',
...          'rabbit', 'giraffe', 'coyote', 'horse']
>>> df = pd.DataFrame({'speed': speed,
...                    'lifespan': lifespan}, index=index)
>>> ax = df.plot.bar(rot=0)
Comment

pd df plot bar stacked

ax = df.plot.bar(stacked=True)
Comment

PREVIOUS NEXT
Code Example
Python :: indexing python first and last 
Python :: python package structure 
Python :: display pandas dataframe with border 
Python :: format in python 
Python :: iterate over a set python 
Python :: how to download from youtube in discord.py 
Python :: poppler on colab 
Python :: indexes meta django 
Python :: sort a dict by values 
Python :: python int binary 
Python :: python requests post form data 
Python :: python string formatting 
Python :: R sample() funciton in python 
Python :: seaborn boxplot multiple for each column 
Python :: with open 
Python :: seaborn library in python 
Python :: file open in python 
Python :: sympy 
Python :: Python RegEx Split – re.split() 
Python :: insert data in sqlite database in python 
Python :: table in sqlite python 
Python :: numpy ndarray to matrix 
Python :: python use variable name as variable 
Python :: download image from url selenium python 
Python :: flask run 
Python :: how to copy the list in python 
Python :: making ckeditor django responsive 
Python :: urllib.error.HTTPError: HTTP Error 404: Not Found 
Python :: python multiply string 
Python :: Aggregate on the entire DataFrame without group 
ADD CONTENT
Topic
Content
Source link
Name
4+3 =