r/learnpython • u/bunfemmexx • 1d ago
matplotlib graphs from csv file
hi! i dont rly use reddit but i need some help. does anyone know how to make matplotlib graphs from a csv file? i can do the basics but i cant seem to figure out this dataset, and i need to submit my project soon. any and all help is appreciated
3
Upvotes
1
u/chingisooinar 6h ago
If pandas is allowed, this skeleton covers most csv plots:
If you need totals per category, do
df.groupby("category")["value"].sum().plot(kind="bar"). The usual reasons a dataset "won't work" are numbers being read as strings (commas or units in them) or dates not parsed, so usepd.to_numeric(..., errors="coerce")orpd.read_csv(..., parse_dates=["date"]). If you paste the output ofdf.head()I can help with the exact plot.