Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SuperDataScience logo as a new starter shape. #131

Merged
merged 2 commits into from
May 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions src/data_morph/data/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,20 @@ class DataLoader:
.. plot::
:caption:
Datasets currently included in Data Morph. The ``dino``
shape is Alberto Cairo's `Datasaurus`_. The Python logo
is a `trademark of the Python Software Foundation (PSF)
<https://www.python.org/psf/trademarks/>`_, used with permission
from the Foundation. Note that CSV files are also supported
shape is Alberto Cairo's `Datasaurus`_. All logos are used
with permission (see below). Note that CSV files are also supported
by the :meth:`.load_dataset` method.

from data_morph.data.loader import DataLoader
DataLoader.plot_available_datasets()

.. _Datasaurus: http://www.thefunctionalart.com/2016/08/download-datasaurus-never-trust-summary.html

.. important:: All logos are used with permission.

* The Python logo is a `trademark of the Python Software Foundation (PSF)
<https://www.python.org/psf/trademarks/>`_, used with permission from the Foundation.
* The `SuperDataScience (SDS) <https://www.superdatascience.com/>`_ logo is used with permission.
"""

_DATA_PATH: str = 'data/starter_shapes/'
Expand All @@ -43,9 +47,10 @@ class DataLoader:
'music': 'music.csv',
'panda': 'panda.csv',
'Python': 'python.csv',
'SDS': 'superdatascience.csv',
'sheep': 'sheep.csv',
}
AVAILABLE_DATASETS = sorted(list(_DATASETS.keys()), key=str.lower)
AVAILABLE_DATASETS = sorted(_DATASETS.keys(), key=str.lower)
"""list[str]: List of available built-in starter datasets,
which can be visualized with :meth:`plot_available_datasets`."""

Expand Down Expand Up @@ -82,7 +87,9 @@ def load_dataset(
class directly.
"""
if dataset == 'python':
dataset = 'Python'
dataset = dataset.capitalize()
elif dataset == 'sds':
dataset = dataset.upper()
try:
filepath = files(MAIN_DIR).joinpath(
Path(cls._DATA_PATH) / cls._DATASETS[dataset]
Expand Down Expand Up @@ -115,7 +122,7 @@ def plot_available_datasets(cls) -> Axes:
See Also
--------
AVAILABLE_DATASETS
The list of available datasets built into ``data_morph``.
The list of available datasets built into Data Morph.
"""
num_plots = len(cls.AVAILABLE_DATASETS)
num_cols = 3
Expand Down Expand Up @@ -145,6 +152,8 @@ def plot_available_datasets(cls) -> Axes:

if dataset == 'Python':
dataset += u' logo\u2122'
elif dataset == 'SDS':
dataset += ' logo'

ax.scatter(points.df.x, points.df.y, s=4, color='black')
ax.set(
Expand Down
Loading