Pandas plots

Pandas utilise la méthode plot() pour créer des diagrammes.

Nous pouvons utiliser Pyplot, un sous-module de la bibliothèque Matplotlib pour visualiser le diagramme à l'écran.

import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_csv('https://www.w3schools.com/python/pandas/data.csv')
df.plot()
plt.show()

Output:

Scatter:

import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_csv('https://www.w3schools.com/python/pandas/data.csv')
df.plot(kind = 'scatter', x = 'Duration', y = 'Calories')
plt.show()

Output:


 

Histogramme:

import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_csv('https://www.w3schools.com/python/pandas/data.csv')
df["Duration"].plot(kind = 'hist')
plt.show()

Output: