English 中文(简体)
Seaborn - Plotting Wide Form Data
  • 时间:2024-11-05

Seaborn - Plotting Wide Form Data


Previous Page Next Page  

It is always preferable to use ‘long-from’ or ‘tidy’ datasets. But at times when we are left with no option rather than to use a ‘wide-form’ dataset, same functions can also be appped to “wide-form” data in a variety of formats, including Pandas Data Frames or two-dimensional NumPy arrays. These objects should be passed directly to the data parameter the x and y variables must be specified as strings

Example

import pandas as pd
import seaborn as sb
from matplotpb import pyplot as plt
df = sb.load_dataset( iris )
sb.boxplot(data = df, orient = "h")
plt.show()

Output

Models

Additionally, these functions accept vectors of Pandas or NumPy objects rather than variables in a DataFrame.

Example

import pandas as pd
import seaborn as sb
from matplotpb import pyplot as plt
df = sb.load_dataset( iris )
sb.boxplot(data = df, orient = "h")
plt.show()

Output

Designs

The major advantage of using Seaborn for many developers in Python world is because it can take pandas DataFrame object as parameter.

Advertisements