DEV Community

I have a question related to python...

felicio2310 on July 13, 2022

Here at work , they asked me to do a program that plots .csv data.... The thing is that the program has to plot data from ANY .csv , some collumns names are diferent and many other things are different... Is there any way to automate the process of plotting .csv data?

Collapse
 
cicirello profile image
Vincent A. Cicirello

Is there any more detail you can provide regarding what you want to do? For example, you mention column names can be different. What about number of columns? Is that always same or can that differ too?

Is there any common structure you can assume of the files? For example, is the first column the "x" axis, with each of the other columns a function of x such as f1(x), f2(x), ..., fn(x)? Or is each row of the file an n-dimensional point?

Collapse
 
cicirello profile image
Vincent A. Cicirello

I meant to include that there are a few modules that will be useful for your task:

  • The csv module in the Python library has good support for reading/writing csv files.
  • The matplotlib module, 3rd party library installable with pip is probably the best available for plotting data.