Python Forum
blank graph with matplotlib from a csv file / data type issue
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
blank graph with matplotlib from a csv file / data type issue
#1
Hi All. I'm new to Python and hoping to get some help here. I'm trying to create some simple bar/line graphs from a csv file, however, it gives me an empty graph until I open this csv file manually in excel and change the data type to numeric. I've tried changing the data type with pd.to_numeric but it still gives an empty graph.

The csv that I'm trying to visualise is web data that I scraped using Beautiful Soup, I used .text method do get rid of all of the HTML tags so maybe it's causing the issue?

Would really appreciate some help. thanks!

Data file: https://dropmefiles.com/AYTUT

import numpy
import matplotlib
from matplotlib import pyplot as plt
import pandas as pd
import csv

my_data = pd.read_csv('my_data.csv')
plt.bar(x= my_data['Company'], height= my_data['Market_Cap'])
plt.show()
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Embed Matplotlib Graph to Tkinter? dimidgen 0 229 Mar-04-2024, 07:40 PM
Last Post: dimidgen
  How to read csv file update matplotlib column chart regularly SamLiu 2 1,058 Jan-21-2023, 11:33 PM
Last Post: SamLiu
  PIL ImageTk issue with MATPLOTLIB garynewport 0 1,764 Jan-17-2023, 11:32 AM
Last Post: garynewport
  Issue in writing sql data into csv for decimal value to scientific notation mg24 8 3,006 Dec-06-2022, 11:09 AM
Last Post: mg24
  please check this i wanna use a csv file as a graph xCj11 5 1,480 Aug-25-2022, 08:19 PM
Last Post: deanhystad
  Graphic line plot with matplotlib, text file in pytho khadija 2 1,375 Aug-15-2022, 12:00 PM
Last Post: khadija
  Issue in changing data format (2 bytes) into a 16 bit data. GiggsB 11 2,644 Jul-25-2022, 03:19 PM
Last Post: deanhystad
  Delimiter issue with a CSV file jehoshua 1 1,279 Apr-19-2022, 01:28 AM
Last Post: jehoshua
  File handling issue GiggsB 4 1,419 Mar-31-2022, 09:35 PM
Last Post: GiggsB
  How to conditionally specify markers in matplotlib graph Mark17 3 3,211 Mar-03-2022, 07:42 PM
Last Post: Mark17

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020