plotting pie chart from csv data?

Clash Royale CLAN TAG#URR8PPPplotting pie chart from csv data?
For data of car performance such as:
Model Running Rest
1 10 14
1 11 13
1 12 12
2 9 15
2 10 14
how to plot Running and Rest each value plot here and also case like for 1st three rows since Model no is same?
Running
Rest
Model
import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_csv('performance.csv')
df.pie(x='Running', y='Rest', autopct='%1.1f%%', shadow=True, startangle=140))
After seeing few answers on stackoverflow I proceeded as:
import csv as csv
import matplotlib.pyplot as plt
colors = ['r', 'g']
with open('performance.csv') as csvfile:
readCSV = csv.reader(csvfile, delimiter=',')
i = 0
for row in readCSV:
if i == 0:
activities = [row[1], row[2]]
title = row[0]
else:
slices = [row[1], row[2]]
plt.title("Model: " + row[0])
plt.pie(slices, labels=activities, colors=colors, startangle=90, autopct='%.1f%%')
plt.show()
i += 1
This code gives me each rows value of Running and Rest as a pie chart.
Running
Rest
But how to get pie chart for say 1st three rows where Model is same?
df.plot.pie
df.plot.pie only gives plot of one column only, How could here a plot can be made between unique values of two columns ...say for 1st row Running=10 and Rest=14 @Lex– surya rahul
40 mins ago
df.plot.pie
Running=10
Rest=14
@jpp Kindly have a look !!!
– surya rahul
18 mins ago
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Did you try
df.plot.pielooking at the docs it looks like a method off plot not the dataframe itself pandas.pydata.org/pandas-docs/version/0.22/generated/…– Lex
43 mins ago