enter image description here
Hi everyone, I'm trying to plot a graph data from CSV. There are 7 columns in my CSV. I've already plot the Genre column with my code:
import pandas as pd
import matplotlib.pyplot as plt
import plotly.express as px
import numpy as np
df = pd.read_csv('booksellers.csv')
genre = df['Genre']
countFiction = 0
countNonFiction = 0
for i in genre:
if i == "Fiction":
countFiction+=1
else:
countNonFiction+=1
labels = 'Fiction','Non Fiction'
sizes = [countFiction,countNonFiction]
fig1, ax1 = plt.subplots()
ax1.pie(sizes,labels=labels,startangle=90,autopct='%1.1f%%')
plt.show()
Now, I want to plot another 2 columns which are 'Author' and the average of 'User Rating'. If the Author is duplicated, how can I get only one Author with their average user rating? And also what kind of graph is compatible with it?
question from:
https://stackoverflow.com/questions/65545877/python-plot-data-from-csv 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…