-
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.
- Loading branch information
Showing
18 changed files
with
120 additions
and
39 deletions.
There are no files selected for viewing
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
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,2 +1 @@ | ||
from data_flow.data_flow import DataFlow | ||
from data_flow.lib.FileType import FileType | ||
from .data_flow import DataFlow |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from enum import Enum | ||
|
||
|
||
class Operator(Enum): | ||
Eq = "==" | ||
Gt = ">" | ||
Lt = "<" | ||
Gte = ">=" | ||
Lte = "<=" | ||
Ne = "!=" |
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 +1,2 @@ | ||
from .FileType import FileType | ||
from .Operator import Operator |
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
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,23 @@ | ||
import fireducks.pandas as fd | ||
|
||
from data_flow.lib.FileType import FileType | ||
|
||
|
||
def from_fireducks_2_file(df: fd.DataFrame, tmp_filename: str, file_type: FileType) -> None: | ||
match file_type: | ||
case FileType.parquet: | ||
df.to_parquet(tmp_filename) | ||
case FileType.feather: | ||
df.to_feather(tmp_filename) | ||
case _: | ||
raise ValueError(f"File type not implemented: {file_type} !") | ||
|
||
|
||
def to_fireducks_from_file(tmp_filename: str, file_type: FileType) -> fd.DataFrame: | ||
match file_type: | ||
case FileType.parquet: | ||
return fd.read_parquet(tmp_filename) | ||
case FileType.feather: | ||
return fd.read_feather(tmp_filename) | ||
case _: | ||
raise ValueError(f"File type not implemented: {file_type} !") |
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,24 @@ | ||
import fireducks.pandas as fd | ||
import pandas as pd | ||
|
||
from data_flow.lib.FileType import FileType | ||
|
||
|
||
def from_pandas_2_file(df: pd.DataFrame, tmp_filename: str, file_type: FileType) -> None: | ||
match file_type: | ||
case FileType.parquet: | ||
fd.from_pandas(df).to_parquet(tmp_filename) | ||
case FileType.feather: | ||
fd.from_pandas(df).to_feather(tmp_filename) | ||
case _: | ||
raise ValueError(f"File type not implemented: {file_type} !") | ||
|
||
|
||
def to_pandas_from_file(tmp_filename: str, file_type: FileType) -> fd.DataFrame: | ||
match file_type: | ||
case FileType.parquet: | ||
return pd.read_parquet(tmp_filename) | ||
case FileType.feather: | ||
return pd.read_feather(tmp_filename) | ||
case _: | ||
raise ValueError(f"File type not implemented: {file_type} !") |
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,12 @@ | ||
import polars as pl | ||
|
||
from data_flow.lib import FileType | ||
from data_flow.lib.pandas import to_pandas_from_file, from_pandas_2_file | ||
|
||
|
||
def from_polars_2_file(df: pl.DataFrame, tmp_filename: str, file_type: FileType) -> None: | ||
from_pandas_2_file(df=df.to_pandas(), tmp_filename=tmp_filename, file_type=file_type) | ||
|
||
|
||
def to_polars_from_file(tmp_filename: str, file_type: FileType) -> pl.DataFrame: | ||
return pl.from_pandas(to_pandas_from_file(tmp_filename=tmp_filename, file_type=file_type)) |
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,5 +1,5 @@ | ||
black | ||
flake8 | ||
flake8-pyproject | ||
pyproject-flake8 | ||
pytest | ||
pytest-cov |
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
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
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