import pandas as pd
my_dict={
'NAME':['Ravi','Raju','Alex','Ron','Geek','Kim'],
'MARK':[20,30,40,30,40,50]
}
my_df = pd.DataFrame(data=my_dict)
print(my_df)
Output is here
NAME MARK
0 Ravi 20
1 Raju 30
2 Alex 40
3 Ron 30
4 Geek 40
5 Kim 50
import pandas as pd
my_dict={
'NAME':['Ravi','Raju','Alex',
'Ron','Geek','Kim'],
'MARK':[20,30,40,30,40,50]
}
df = pd.DataFrame(data=my_dict)
df.plot.line(title="Std Mark");
import pandas as pd
my_dict={
'NAME':['Ravi','Raju','Alex',
'Ron','Geek','Kim'],
'MARK':[20,30,40,30,40,50]
}
df = pd.DataFrame(data=my_dict)
my_style=['-.']
df.plot.line( title="Student Mark",figsize=(6,3),x='NAME',y='MARK',
use_index=True,grid=True,legend=True,style=my_style)
import pandas as pd
my_dict={
'NAME':['Ravi','Raju','Alex',
'Ron','Geek','Kim'],
'MARK':[20,30,40,30,40,50],
'ENGLISH':[80,70,60,70,90,80]
}
df = pd.DataFrame(data=my_dict)
df.plot.line( title="Student Mark",x='NAME',y='ENGLISH',use_index=True,legend=True)
my_style=[':']
df.plot.line( title="style =[ ':'] ",x='NAME',style=my_style)
We can specify log scaling or symlog scaling for x ( logx=True ) or y ( logy=True ) or for both x & y ( loglog=True)
df.plot.line( title="loglog=True",figsize=(5,3),loglog=True)
df.plot.line( title="secondary_y=True",x='NAME',figsize=(5,3),secondary_y=True)
df.plot.line( title="rot=180",x='NAME',figsize=(5,3),rot=180)
Pandas plot Pie plot
Bar plot
Box plot
Density plot
Area plot
Scatter Plot
Hexbin plot
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.