Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

graph a line from dataframe values over a bar plot in python

df = pd.DataFrame({'year':[2001,2002,2003,2004,2005], 'value':[100,200,300,400,500]})
df['value1']= df['value']*0.4
df['value2'] = df['value']*0.6
df['year'] = df['year'].astype("string") # Let them be strings!
fig, ax = plt.subplots(figsize = (15,8))
df.plot(x = ['year'], y = ['value'], kind = 'line', ax = ax)
df.plot(x = ['year'], y= ['value1','value2'], kind = 'bar', ax = ax)
Comment

PREVIOUS NEXT
Code Example
Python :: python list object ids 
Python :: doomsday fuel foobar 
Python :: pivot pyspark 
Python :: python - how many letters are capital in a string 
Python :: create new python environment check 
Python :: download pytz python 
Python :: flask session timeout 
Python :: os chdir python 
Python :: convert generator to list python 
Python :: addition of matrix in python using numpy 
Python :: ast python 
Python :: telegram bot webhook python 
Python :: linking bootstrap in flask 
Python :: static files in django 
Python :: how to run a python script in background windows 
Python :: tk inter entry 
Python :: python pandas series to title case 
Python :: how to check encoding of csv 
Python :: find number of unique keys in the dictionary 
Python :: get UTC time for IST time python 
Python :: python tkinter entry widget 
Python :: Django how to get url path for a view 
Python :: python square number 
Python :: get array dimension numpy 
Python :: Spotify API Authentication in Python 
Python :: python code execution time 
Python :: python list files in folder with wildcard 
Python :: sort and reverse list in python 
Python :: python sleep timer 
Python :: python dropbox 
ADD CONTENT
Topic
Content
Source link
Name
2+8 =