Bivariate plots in pandas
Comparing multiple variables simultaneously is also another useful way to understand your data. When you have two continuous variables, a scatter plot is usually used.
# Scatter plot
df.plot(x='x_column', y='y_column', kind='scatter')
plt.show()
You can use a boxplot to compare one continuous and one categorical variable. However, you will be using the .boxplot()
method instead of the .plot()
method.
# Boxplot
df.boxplot(column='y_column', by='x_axis')
plt.show()
Este ejercicio forma parte del curso
Python for R Users
Ejercicio interactivo práctico
Prueba este ejercicio completando el código de muestra.
import matplotlib.pyplot as plt
# Scatter plot between the tip and total_bill
tips.plot(____, ____, ____)
plt.show()