How to plot multiple pandas columns

To plot multiple columns from a Pandas DataFrame, you can use the DataFrame.plot() method and specify the column names you want to plot as a list in the x and y parameters. You can also specify the kind parameter to specify the type of plot you want to create (e.g., line, bar, scatter).

Here is an example of how to plot multiple columns from a Pandas DataFrame using the plot() method:

import matplotlib.pyplot as plt
 
# Load data into a Pandas DataFrame
df = pd.read_csv("data.csv")
 
# Select the columns you want to plot
x = ['col1', 'col2']
y = ['col3', 'col4']
 
# Create the plot
df.plot(x=x, y=y, kind='line')
 
# Show the plot
plt.show()

This will create a line plot with col1 and col2 on the x-axis and col3 and col4 on the y-axis.

You can also use the plot() method directly on a single column of a DataFrame if you only want to plot a single column. For example:

df['col1'].plot()
plt.show()
 

This will create a line plot of the col1 column.