Dataset#

class data_morph.data.dataset.Dataset(name: str, df: DataFrame, scale: Number = None)[source]#

Bases: object

Class for representing a starting dataset and bounds.

../_images/data_morph-data-dataset-Dataset-1.png

Upon creation, these bounds are automatically calculated. Use plot() to generate this visualization.#

Parameters:
  • name (str) – The name to use for the dataset.

  • df (pandas.DataFrame) – DataFrame containing columns x and y.

  • scale (numbers.Number, optional) – The factor to scale the data by (can be used to speed up morphing). Values in the data’s x and y columns will be divided by this value.

See also

DataLoader

Utility for creating Dataset objects from CSV files.

data_bounds: BoundingBox#

The bounds of the data.

Type:

BoundingBox

df: DataFrame#

DataFrame containing columns x and y.

Type:

pandas.DataFrame

morph_bounds: BoundingBox#

The limits for the morphing process.

Type:

BoundingBox

name: str#

The name to use for the dataset.

Type:

str

plot(ax: Axes = None, show_bounds: bool = True, title: str = 'default') Axes[source]#

Plot the dataset and its bounds.

Parameters:
  • ax (matplotlib.axes.Axes, optional) – An optional Axes object to plot on.

  • show_bounds (bool, default True) – Whether to plot the bounds of the dataset.

  • title (str, optional) – Title to use for the plot. The default will call str() on the Dataset. Pass None to leave the plot untitled.

Returns:

The Axes object containing the plot.

Return type:

matplotlib.axes.Axes

plot_bounds: BoundingBox#

The bounds to use when plotting the morphed data.

Type:

BoundingBox