-1

I have two csv which have 5 columns id product name normal price discount price card price and discount both csv have different prices from different timelines so i am looking to plot a graph because i want to see the behavior of the prices for each product, both have products that are repeated, so I would like those that are repeated to appear in the graph.

I tried converting to a data frame but no success. This is how it look the csv file

  • 1
    Does this answer your question? [How to plot CSV data using matplotlib and pandas in python](https://stackoverflow.com/questions/42372617/how-to-plot-csv-data-using-matplotlib-and-pandas-in-python) – Let's try Dec 07 '22 at 18:00

1 Answers1

0

It would be helpful to your second .csv file too.

From this answer.

Assuming both your files have the same column names, use Pandas' pandas.concat() method to make one dataframe from a list of dataframes. Then, simply plot a graph of your new dataframe as usual.

import pandas as pd

listOfDFs = []

df1 = pd.read_csv('csv1.csv')
df2 = pd.read_csv('csv2.csv')

listOfDFs.append(df1)
listOfDFs.append(df2)
dfBoth = pd.concat(listOfDFs, axis=0, ignore_index=True)

dfBoth.plot()
nau5ea
  • 13
  • 4