Matplotlib Tutorial 7 – loading data from files




[ad_1]

Many times, people want to graph data from a file. There are many types of files, and many ways you may extract data from a file to graph it. Here, we’ll show a couple of ways one might do this. First, we’ll use the built-in csv module to load CSV files, then we’ll show how to utilize NumPy, which is a third-party module, to load files.

sample code: http://pythonprogramming.net
http://hkinsley.com
https://twitter.com/sentdex
http://sentdex.com
http://seaofbtc.com

Source


[ad_2]

Comment List

  • sentdex
    December 11, 2020

    you sound like a nice guy to drink in a bar for a nice chat.

  • sentdex
    December 11, 2020

    This does not belong in a playlist on matplotlib if you ask me.

  • sentdex
    December 11, 2020

    ValueError: could not convert string to float:

    why do I get this message?

  • sentdex
    December 11, 2020

    Starts from 6:40.

  • sentdex
    December 11, 2020

    Hey quick question, if my text file had one x axis list, but multiple y axis lists, how would you modify the numpy code (if you need to at all?). would you just have to define y1, y2, y3, y4, y5?

  • sentdex
    December 11, 2020

    I was just wondering if there is an excel file as a csv and different numbers in each row what would the delimeter be?

  • sentdex
    December 11, 2020

    Seen it.

  • sentdex
    December 11, 2020

    what if the csv has column label (in the first row?)

  • sentdex
    December 11, 2020

    Isn’t it true that matplotlib requires numpy? So…

  • sentdex
    December 11, 2020

    Dude, you are the fucking man. I wrote a program in Java that was a few hundred lines of code, and in Python it is less than 100. Insanity.

  • sentdex
    December 11, 2020

    If my data consists of decimals? does the index for row change?

  • sentdex
    December 11, 2020

    ValueError: could not convert string to float:

    i am getting the above comment please let me know how to run code using numpy

  • sentdex
    December 11, 2020

    [error:]hey,this program runs perfectly when the file is located in the python folder.BUT when i specify the path it shows "TypeError: data type "r" not understood" this error and this happens while working with (NUMPY). i hope you'll help me!

  • sentdex
    December 11, 2020

    I am getting an error
    IndexError Traceback (most recent call last)

    <ipython-input-95-caaa25484032> in <module>()

    5 plots = csv.reader(csvfile, delimiter=',')

    6 for row in plots:

    —-> 7 x.append(int(row[0]))

    8 y.append(int(row[1]))

    9

    IndexError: list index out of range

  • sentdex
    December 11, 2020

    I was getting the error that example.txt not found how can I resolve this?

  • sentdex
    December 11, 2020

    how we will load data from excel sheet?

  • sentdex
    December 11, 2020

    How can I require the user when they don't enter [number, 'comma',nuber] next by next one?

  • sentdex
    December 11, 2020

    I'm using colab in ubuntu, ok? But I don't look the file, (I guess):
    [Errno 2] No such file or directory: 'example.txt'
    what do I do?

  • sentdex
    December 11, 2020

    how can we read another python file which is already drawing graphs instead of csv.

  • sentdex
    December 11, 2020

    Gracias señor

  • sentdex
    December 11, 2020

    thanks for the tutorial, how do I specify more than one delimiter such as comma and space?
    Thanks

  • sentdex
    December 11, 2020

    Thank you very much for this tutorial, helped a lot. Can this be used for a 3d plot where i have 3 lists x,y and z, whose data is read from a file…

  • sentdex
    December 11, 2020

    Is there any way to read a single line of a file with numpy?
    Thx so much!! I love your videos because they are so helpful!!!

  • sentdex
    December 11, 2020

    Hey, when I follow your code, for the first part I get the following error message: ValueError: invalid literal for int() with base 10:
    and for the second part I get this: ValueError: could not convert string to float:

    I'm using python3 on OSX and can't seem to figure out the issue.

  • sentdex
    December 11, 2020

    how do you plot more than one line on the graph getting the data from a cvs file like the example from the second video on this playlist

  • sentdex
    December 11, 2020

    Hi. Thanks for the video. Can u explain to me how to load .dat file ?

  • sentdex
    December 11, 2020

    Hey thank you for these videos, they are really helpful. I have a question. I want to open multiple 3D image files using matplot as a subplot in the main plot. The files are in the same directory but inside the directory, there are separate folders with two files in each folder. Also, I want to analyze these files. I would appreciate your help.

  • sentdex
    December 11, 2020

    How do you load a file using numpy that has more than two variables?

Write a comment