''' Helper module that with an abstract class containing a static method that returns a joined Pandas Dataframe made of the dog sizes and dog intelligence datasets ''' import pandas as pd class DogDatasets(): ''' Abstract helper class that helps merging the two dog breeds datasets. Contains two static private attibutes with the default dataset URLs ''' __ds1_url = 'https://rcweb.dartmouth.edu/homes/d35398e/data/qbs101/sp21_midterm/dog_breeds.csv' __ds2_url = 'https://rcweb.dartmouth.edu/homes/d35398e/data/qbs101/sp21_midterm/dog_intelligence.csv' @staticmethod def join(ds1_path_or_url=None, ds2_path_or_url=None): ''' Returns a single Pandas Dataframe that combines (inner join) both datasets provided in argument. If either dataset path is missing, or both, the default URL dataset is used. ''' df1 = pd.read_csv(ds1_path_or_url if ds1_path_or_url is not None else DogDatasets.__ds1_url, index_col='breed') return df1.join(pd.read_csv(ds2_path_or_url if ds2_path_or_url is not None else DogDatasets.__ds2_url, index_col='breed'),how='inner')