import os import pandas as pd import numpy as np import csv from abc import ABC, abstractmethod class DataSet(ABC): ''' Manage datasets of pollutants and meteorological data, in the format specified by KNMI. ''' def __init__(self) -> None: self._dataframe = None def __getitem__(self, index:int): ''' Allows its instances to use the [] (indexer) operators. ''' if index not in range(0, len(self)): raise IndexError("Index out of bounds.") return self._dataframe.iloc[index] def __len__(self) -> int: ''' Get the number of datapoints in the dataset. ''' return len(self._dataframe) def get_df(self) -> pd.DataFrame: return self._dataframe @abstractmethod def _filter_data(self): ''' Filters the dataset based on the variable(s) included. ''' pass