-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
8 enh compare two and only two dataframes by common attributes (#23)
- Loading branch information
Showing
9 changed files
with
42 additions
and
4 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* @hadarsharon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from typing import Iterable, Any | ||
|
||
from dask.dataframe.core import DataFrame as DaskDataFrame | ||
from modin.pandas.dataframe import DataFrame as ModinDataFrame | ||
from pandas.core.frame import DataFrame as PandasDataFrame | ||
from polars.dataframe.frame import DataFrame as PolarsDataFrame | ||
from pyspark.sql.dataframe import DataFrame as SparkDataFrame | ||
|
||
|
||
class DataFrame: | ||
"""Generic (bear-agnostic) DataFrame type""" | ||
|
||
def __init__(self, df: PolarsDataFrame | PandasDataFrame | SparkDataFrame | DaskDataFrame | ModinDataFrame): | ||
self._df = df | ||
|
||
# TODO: property | ||
def shape(self) -> tuple[int, int]: | ||
if isinstance(self.df, (PolarsDataFrame, PandasDataFrame, ModinDataFrame)): | ||
return self.df.shape | ||
if isinstance(self.df, DaskDataFrame): | ||
... # TODO: figure out | ||
if isinstance(self.df, SparkDataFrame): | ||
... # TODO: figure out | ||
|
||
# TODO: property | ||
def columns(self) -> Iterable[Any]: | ||
return self.df.columns | ||
|
||
def n_columns(self) -> int: | ||
return len(self.columns()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
dask==2024.2.1 # support for dask DataFrames | ||
modin[dask]==0.27.0 # support for modin DataFrames | ||
pandas==2.2.1 # support for pandas DataFrames | ||
polars==0.20.10 # support for polars DataFrames | ||
pre-commit==3.6.2 # pre-commit hooks | ||
pyspark==3.5.0 # support for spark DataFrames | ||
pytest==8.0.1 # testing framework | ||
ruff==0.2.2 # formatter/linter |