Added methods to read data from polars.
This commit is contained in:
parent
48da9c5730
commit
3d7f0ca783
|
@ -1,16 +1,11 @@
|
|||
# Python Imports
|
||||
import abc
|
||||
from abc import ABC
|
||||
import polars as pl
|
||||
|
||||
|
||||
class BaseDataSimulationHandler(ABC):
|
||||
|
||||
def __init__(self):
|
||||
self._data = None
|
||||
|
||||
@abc.abstractmethod
|
||||
def load_data(self, path):
|
||||
pass
|
||||
|
||||
@abc.abstractmethod
|
||||
def convert_into_dataframe(self):
|
||||
def load_data(self, path: str) -> pl.DataFrame:
|
||||
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
|
||||
|
||||
|
||||
class CsvDataSimulationHandler(BaseDataSimulationHandler):
|
||||
|
||||
def load_data(self, path):
|
||||
pass
|
||||
def load_data(self, path: str) -> pl.DataFrame:
|
||||
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
|
||||
|
||||
|
||||
class JsonDataSimulationHandler(BaseDataSimulationHandler):
|
||||
|
||||
def load_data(self, path):
|
||||
pass
|
||||
def load_data(self, path: str) -> pl.DataFrame:
|
||||
polars_df = pl.read_json(path)
|
||||
|
||||
def convert_into_dataframe(self):
|
||||
pass
|
||||
return polars_df
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
class ParquetDataSimulationHandler(BaseDataSimulationHandler):
|
||||
|
||||
def load_data(self, path):
|
||||
pass
|
||||
def load_data(self, path: str) -> pl.DataFrame:
|
||||
polars_df = pl.read_parquet(path)
|
||||
|
||||
def convert_into_dataframe(self):
|
||||
pass
|
||||
return polars_df
|
||||
|
|
Loading…
Reference in New Issue