Skip to content

Commit

Permalink
Add docstrings.
Browse files Browse the repository at this point in the history
  • Loading branch information
jbenjoseph committed Feb 22, 2024
1 parent d5af791 commit 8479a59
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions aiondata/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ class CachedDataset:
)

def to_df(self) -> pl.DataFrame:
"""
Converts the dataset to a Polars DataFrame.
Returns:
pl.DataFrame: The dataset as a Polars DataFrame.
"""
self.CACHE_DIR.mkdir(parents=True, exist_ok=True)
dataset_name = self.__class__.__name__.lower()
cache_path = self.CACHE_DIR / f"{dataset_name}.parquet"
Expand All @@ -38,6 +44,7 @@ def get_df(self) -> pl.DataFrame:


class GeneratedDataset(CachedDataset):
"""A base class for datasets that are generated on-the-fly."""

def get_df(self) -> pl.DataFrame:
return pl.DataFrame(self.to_generator())

0 comments on commit 8479a59

Please sign in to comment.