mirror of
https://github.com/logos-co/SimulationsFramework.git
synced 2025-02-18 17:06:43 +00:00
Added methods to read data from polars.
This commit is contained in:
parent
48da9c5730
commit
3d7f0ca783
@ -1,16 +1,11 @@
|
|||||||
|
# Python Imports
|
||||||
import abc
|
import abc
|
||||||
from abc import ABC
|
from abc import ABC
|
||||||
|
import polars as pl
|
||||||
|
|
||||||
|
|
||||||
class BaseDataSimulationHandler(ABC):
|
class BaseDataSimulationHandler(ABC):
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
self._data = None
|
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def load_data(self, path):
|
def load_data(self, path: str) -> pl.DataFrame:
|
||||||
pass
|
|
||||||
|
|
||||||
@abc.abstractmethod
|
|
||||||
def convert_into_dataframe(self):
|
|
||||||
pass
|
pass
|
||||||
|
@ -1,10 +1,14 @@
|
|||||||
|
# Python Imports
|
||||||
|
import polars as pl
|
||||||
|
|
||||||
|
# Project Imports
|
||||||
from src.utilities.files.simulation_data_types.base_data_simulation_handler import BaseDataSimulationHandler
|
from src.utilities.files.simulation_data_types.base_data_simulation_handler import BaseDataSimulationHandler
|
||||||
|
|
||||||
|
|
||||||
class CsvDataSimulationHandler(BaseDataSimulationHandler):
|
class CsvDataSimulationHandler(BaseDataSimulationHandler):
|
||||||
|
|
||||||
def load_data(self, path):
|
def load_data(self, path: str) -> pl.DataFrame:
|
||||||
pass
|
polars_df = pl.read_csv(path)
|
||||||
|
|
||||||
|
return polars_df
|
||||||
|
|
||||||
def convert_into_dataframe(self):
|
|
||||||
pass
|
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
|
# Python Imports
|
||||||
|
import polars as pl
|
||||||
|
|
||||||
|
# Project Imports
|
||||||
from src.utilities.files.simulation_data_types.base_data_simulation_handler import BaseDataSimulationHandler
|
from src.utilities.files.simulation_data_types.base_data_simulation_handler import BaseDataSimulationHandler
|
||||||
|
|
||||||
|
|
||||||
class JsonDataSimulationHandler(BaseDataSimulationHandler):
|
class JsonDataSimulationHandler(BaseDataSimulationHandler):
|
||||||
|
|
||||||
def load_data(self, path):
|
def load_data(self, path: str) -> pl.DataFrame:
|
||||||
pass
|
polars_df = pl.read_json(path)
|
||||||
|
|
||||||
def convert_into_dataframe(self):
|
return polars_df
|
||||||
pass
|
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
|
# Python Imports
|
||||||
|
import polars as pl
|
||||||
|
|
||||||
|
# Project Imports
|
||||||
from src.utilities.files.simulation_data_types.base_data_simulation_handler import BaseDataSimulationHandler
|
from src.utilities.files.simulation_data_types.base_data_simulation_handler import BaseDataSimulationHandler
|
||||||
|
|
||||||
|
|
||||||
class ParquetDataSimulationHandler(BaseDataSimulationHandler):
|
class ParquetDataSimulationHandler(BaseDataSimulationHandler):
|
||||||
|
|
||||||
def load_data(self, path):
|
def load_data(self, path: str) -> pl.DataFrame:
|
||||||
pass
|
polars_df = pl.read_parquet(path)
|
||||||
|
|
||||||
def convert_into_dataframe(self):
|
return polars_df
|
||||||
pass
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user