Andrews curves visualize multidimensional/high-dimensional data by mapping each observation onto a function. This function is defined as follows:
Andrews curves have been known to retain means, distance (up to a constant), and variances. As a result, Andrews curves represented by closely spaced functions imply that the accompanying data points will be closely spaced.
andrews_curves()method in pandas
andrews_curves() method in pandas is used to plot Andrews curves on a DataFrame. Each frame row represents a single curve.
pandas.plotting.andrews_curves(frame, class_column, ax=None, samples=200, color=None, colormap=None, **kwargs)
frame: This is the DataFrame to plot.
class_column: This is the name of the column containing class names.
ax: This is the
samples: This corresponds to the number of points to plot in each curve.
color: This parameter can be a list or tuple of colors that can be used for different classes.
colormap: This can be a string or a
matplotlibobject where colors can be selected from the colormap.
import pandas as pd import matplotlib.pyplot as plt df = pd.read_csv( 'https://raw.github.com/pandas-dev/' 'pandas/main/pandas/tests/io/data/csv/iris.csv' ) print(df.head()) pd.plotting.andrews_curves(df, 'Name') plt.show()
andrews_curves()method. Here, the
Namecolumn in the dataset/DataFrame is a categorical column consisting of class names.
View all Courses