问题
Imagine I have a very big csv file with 500 rows and 500 columns. Part of the data shown : a small section of my data
I cannot delete the first couple of rows from my file but I can omit them using "skiprows" while reading the file.
Then I want to plot my data and all methods that I try fail. I actually get a plot if I just use 'plot()" command but what I want is to have the first column as my x data and the rest of 499 columns as my y data. Could you please help me with this?
回答1:
If df
is your DataFrame and the first column is named x-data
, then you can plot all other columns vs x-data
like so:
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
df.iloc[:i+1,:].plot(x='x-data', ax=ax)
来源:https://stackoverflow.com/questions/62036205/plotting-many-columns-from-a-csv-file