Exemplo n.º 1
0
    def __init__(self, datasource, dataset):
        self.csv_df = pd.DataFrame()

        # create the Extract object
        extract_obj = Extract()

        if datasource == 'api':
            self.data = extract_obj.get_api_data(dataset)
            func_name = datasource + "_" + dataset
            getattr(self, func_name)()
        elif datasource == 'csv':
            self.data = extract_obj.get_csv_data(dataset)
            func_name = datasource + "_" + dataset
            getattr(self, func_name)()
        else:
            print('Unknown data source!!! Please try again...')
Exemplo n.º 2
0
    def __init__(self, data_source, data_set):

        extract_obj = Extract()
        func_name = f"{data_source}_{data_set}"

        if data_source == 'api':
            self.data = extract_obj.get_api_data(data_set)

        elif data_source == 'csv':
            self.data = extract_obj.get_csv_data(data_set)

        else:
            print('Unkown Data Source')
            return

        # getattr function takes in function name of class and calls it.
        getattr(self, func_name)()