def test_read_all_columns(self, columns_to_load_from_url): # Local load, read all columns. param_config = { "input_parameters": { "source_data_url": os.path.join("test_datasets", "test_1.csv"), "datetime_column_name": "first_column", "index_column_name": "first_column", "dateparser_options": { "date_formats": ["%Y-%m-%dT%H:%M:%S"] } } } if columns_to_load_from_url is None: pass else: param_config["input_parameters"]["columns_to_load_from_url"] = columns_to_load_from_url df = ingest_timeseries(param_config) assert df.index.name == "first_column" assert df.index.values[0] == Timestamp("2020-02-25") assert df.index.values[1] == Timestamp("2020-02-26") assert df.index.values[2] == Timestamp("2020-02-27") assert df.columns[0] == "second_column" assert df.iloc[0]["second_column"] == 2 assert df.iloc[1]["second_column"] == 5 assert df.iloc[2]["second_column"] == 8 assert df.columns[1] == "third_column" assert df.iloc[0]["third_column"] == 3 assert df.iloc[1]["third_column"] == 6 assert df.iloc[2]["third_column"] == 9 assert df.index.freq == '1d'
def integration_test__should__transfer_data__when__the_method_is_called( self): adwords_reports_to_s3_util = AdWordsReportsToS3( AdWordsReportToS3Settings(source_query="", source_include_zero_impressions=True, source_connection_settings=None, target_bucket="test-target-bucket", target_key_prefix="", target_file_prefix="", target_connection_settings=None, transformation_field_type_mask=None)) input_value_dict = { 'ad_group_id': { 0: 94823864785, 1: 34523864785 }, 'labels': { 0: 'Hello_1', 1: 'Hello_2' }, 'tuple_field': { 0: ('field_1', 'val_1'), 1: ('field_2', 'val_2') }, 'bool_field': { 0: True, 1: False }, 'array_field': { 0: ['["v1", "v2"]'], 1: ['[["v1", "v2"], []]'] }, 'num_array_filed': { 0: ['1', '3', '4', '5'], 1: ['1', '3', '4', '5'] }, 'time_field': { 0: Timestamp('2020-06-18 00:00:00'), 1: Timestamp('2020-06-18 00:00:00') }, 'complex_field': { 0: [], 1: ['{"x": "hello", "y": "world"}'] } } data_frame = pd.DataFrame(data=input_value_dict) def _get_report_data(self): return data_frame AdWordsReportsToS3._get_report_data = _get_report_data def upload_dataframe_as_parquet(self, dataframe, key, file_name): pass S3Util.upload_dataframe_as_parquet = upload_dataframe_as_parquet kwargs = {} AdWordsReportsToS3.transfer(adwords_reports_to_s3_util, **kwargs)
def test_infer_freq(self): # Local load, with datetime. Infer freq. param_config = { "input_parameters": { "source_data_url": os.path.join("test_datasets", "test_1.csv"), "columns_to_load_from_url": "first_column,third_column", "datetime_column_name": "first_column", "index_column_name": "first_column", "dateparser_options": { "date_formats": ["%Y-%m-%dT%H:%M:%S"] } } } df = ingest_timeseries(param_config) assert df.index.name == "first_column" assert df.index.values[0] == Timestamp("2020-02-25") assert df.index.values[1] == Timestamp("2020-02-26") assert df.index.values[2] == Timestamp("2020-02-27") assert df.columns[0] == "third_column" assert df.iloc[0]["third_column"] == 3 assert df.iloc[1]["third_column"] == 6 assert df.iloc[2]["third_column"] == 9 assert df.index.freq == '1d'
def test_init_and_end_datetime(self, are_dateparser_options_specified): # Select rows using both init and end time. param_config = { "selection_parameters": { "init_datetime": "2000-01-02", "end_datetime": "2000-01-04" }, } if are_dateparser_options_specified: param_config["input_parameters"] = {} param_config["input_parameters"]["dateparser_options"] = { "date_formats": ["%Y-%m-%dT%H:%M:%S"] } df = get_fake_df(length=5) selected_df = select_timeseries_portion(df, param_config) assert selected_df.index.values[0] == Timestamp("2000-01-02") assert selected_df.index.values[1] == Timestamp("2000-01-03") assert selected_df.index.values[2] == Timestamp("2000-01-04") assert df.iloc[1]["value"] == selected_df.iloc[0]["value"] assert df.iloc[2]["value"] == selected_df.iloc[1]["value"] assert df.iloc[3]["value"] == selected_df.iloc[2]["value"] assert len(selected_df) == 3
def test_given_freq(self): # Local load, with datetime. Specify freq. param_config = { "input_parameters": { "source_data_url": os.path.join("test_datasets", "test_1_1.csv"), "columns_to_load_from_url": "first_column,third_column", "datetime_column_name": "first_column", "index_column_name": "first_column", "dateparser_options": { "date_formats": ["%Y-%m-%dT%H:%M:%S"] }, "frequency": "M" } } df = ingest_timeseries(param_config) assert df.index.name == "first_column" assert df.index.values[0] == Timestamp("2011-01-31 18:00:00") assert df.index.values[1] == Timestamp("2011-02-28 18:00:00") assert df.index.values[2] == Timestamp("2011-03-31 18:00:00") assert df.columns[0] == "third_column" assert df.iloc[0]["third_column"] == 3 assert df.iloc[1]["third_column"] == 6 assert df.iloc[2]["third_column"] == 9 assert df.index.freq == 'M'
def test__should__return_dataframe__when__a_list_of_dictionaries_with_complex_lists_is_given( self): input_value = [{ 'adGroupId': 94823864785, 'labels': 'Hello_1', 'tuple_field': ("field_1", "val_1"), 'bool_field': True, 'array_field': [["v1", "v2"]], 'num_array_filed': [1, 3, 4, 5], 'time_field': datetime.datetime(2020, 6, 18), 'complex_field': [] }, { 'adGroupId': 34523864785, 'labels': 'Hello_2', 'tuple_field': ("field_2", "val_2"), 'bool_field': False, 'array_field': [[["v1", "v2"], []]], 'num_array_filed': [1, 3, 4, 5], 'time_field': datetime.datetime(2020, 6, 18), 'complex_field': [TestObject()] }] actual = nested_list_of_dict_to_dataframe(input_value) data = { 'ad_group_id': { 0: 94823864785, 1: 34523864785 }, 'labels': { 0: 'Hello_1', 1: 'Hello_2' }, 'tuple_field': { 0: ('field_1', 'val_1'), 1: ('field_2', 'val_2') }, 'bool_field': { 0: True, 1: False }, 'array_field': { 0: ['["v1", "v2"]'], 1: ['[["v1", "v2"], []]'] }, 'num_array_filed': { 0: ['1', '3', '4', '5'], 1: ['1', '3', '4', '5'] }, 'time_field': { 0: Timestamp('2020-06-18 00:00:00'), 1: Timestamp('2020-06-18 00:00:00') }, 'complex_field': { 0: [], 1: ['{"x": "hello", "y": "world"}'] } } expected = pd.DataFrame(data=data) assert_frame_equal(expected, actual)
def date_range(beginDate, endDate): dates = [] _start = Timestamp(beginDate) _end = Timestamp(endDate) _date = _start while _date <= _end: dates.append(_date) _date = _date + timedelta(1) return dates
def __init__( self, station_ids: Tuple[str], parameters: Tuple[Union[str, Enum]], start_date: Optional[Union[str, Timestamp, datetime]] = None, end_date: Optional[Union[str, Timestamp, datetime]] = None, humanize_parameters: bool = False, ) -> None: """ :param station_ids: station ids for which data is requested :param parameters: parameters either as strings or enumerations for which data is requested :param start_date: start date of the resulting data, if not start_date: start_date = end_date :param end_date: end date of the resulting data if not end_date: end_date = start_date :param humanize_parameters: bool if parameters should be renamed to meaningful names """ # Make sure we receive a list of ids self.station_ids = pd.Series(station_ids).astype(str).tolist() self.parameters = self._parse_parameters(parameters) # TODO: replace this with a response + logging # TODO: move this to self.collect_data if not self.parameters: raise NoParametersFound( f"No parameters could be parsed from {parameters}") if start_date or end_date: # If only one date given, set the other one to equal if not start_date: start_date = end_date if not end_date: end_date = start_date # TODO: use dynamic parsing that accepts entered timestamps with given # timezone start_date = Timestamp(dateparser.parse(str(start_date)), tz=pytz.UTC) end_date = Timestamp(dateparser.parse(str(end_date)), tz=pytz.UTC) # TODO: replace this with a response + logging if not start_date <= end_date: raise StartDateEndDateError( "Error: 'start_date' must be smaller or equal to 'end_date'." ) self.start_date = start_date self.end_date = end_date self.humanize_parameters = humanize_parameters
def today_or_next_day(time): """ return True if today's news, False otherwise """ today_close_time = Timestamp(time.date()) + timedelta(hours=15, minutes=30) return time <= today_close_time
def millis_to_timestamp(milliseconds): """ Converts a POSIX timestamp in milliseconds (like in Java) to a local datetime. e.g. 1449907200123 -> Timestamp('2015-12-12 08:00:00.123000') Java: 1449918000123 -> Sat Dec 12 08:00:00 BRT 2015 """ return Timestamp(milliseconds, unit='ms')
def timestamp_to_millis(timestamp): """ Converts a local datetime to a POSIX timestamp in milliseconds (like in Java). e.g. '2015-12-12 08:00:00.123000' -> 1449907200123 (UTC) Java: Sat Dec 12 08:00:00 BRT 2015 -> 1449918000123 """ return Timestamp(timestamp).value // 1000000
def test_inflow(self): """ Test that inflow has been converted correctly """ data = { 'Date': { 0: Timestamp('2021-01-01 00:00:00') }, 'Interest Date': { 0: '2021-01-01' }, 'Amount': { 0: 1000.0 }, 'Account': { 0: 'NL52BUNQ123' }, 'Counterparty': { 0: 'NL22INGB123' }, 'Name': { 0: 'test_name' }, 'Description': { 0: 'test_description' } } df = pd.DataFrame(data) converter = Converter(data=df) converter.convert() self.assertEqual(converter.output_data['Inflow'][0], 1000.00)
def do_check(code: str): if 'USD' in code: # 如果是盘前,允许有30分钟的延迟 # 如果是盘中,允许有1分钟的延迟 now = Timestamp.now(tz='Asia/Shanghai') us_calendar: TradingCalendar = trading_calendars.get_calendar( "NYSE") pre_open_last = Timedelta(minutes=30, hours=5) pre_open_allowed_delay = Timedelta(minutes=30) market_open_allowed_delay = Timedelta(minutes=1) next_close = us_calendar.next_close(now) previous_open = us_calendar.previous_open(next_close) pre_open_start = previous_open - pre_open_last if pre_open_start + pre_open_allowed_delay < now < previous_open: try: self.current_price([code], now, pre_open_allowed_delay) except: import traceback logging.error("{}".format(traceback.format_exc())) elif previous_open < now < next_close: try: self.current_price([code], now, market_open_allowed_delay) except: import traceback logging.error("{}".format(traceback.format_exc()))
def test_daily_freq_normalize(self): # df is daily, but with different hours. # Check if it is set so. dates = [pd.Timestamp(datetime(year=2020, month=1, day=1, hour=10, minute=00)), pd.Timestamp(datetime(year=2020, month=1, day=2, hour=12, minute=21)), pd.Timestamp(datetime(year=2020, month=1, day=3, hour=13, minute=30)), pd.Timestamp(datetime(year=2020, month=1, day=4, hour=11, minute=32))] ts = pd.DataFrame(np.random.randn(4), index=dates) new_ts = add_freq(ts) assert ts.iloc[0].equals(new_ts.iloc[0]) assert new_ts.index[0] == Timestamp('2020-01-01 00:00:00', freq='D') assert new_ts.index[1] == Timestamp('2020-01-02 00:00:00', freq='D') assert new_ts.index[2] == Timestamp('2020-01-03 00:00:00', freq='D') assert new_ts.index[3] == Timestamp('2020-01-04 00:00:00', freq='D') assert new_ts.index.freq == "D"
def test_end_datetime(self): # Select rows using end datetime. param_config = { "selection_parameters": { "init_datetime": "1999-01-02", "end_datetime": "2000-01-02" }, } df = get_fake_df(length=3) selected_df = select_timeseries_portion(df, param_config) assert selected_df.index.values[0] == Timestamp("2000-01-01") assert selected_df.index.values[1] == Timestamp("2000-01-02") assert df.iloc[0]["value"] == selected_df.iloc[0]["value"] assert df.iloc[1]["value"] == selected_df.iloc[1]["value"] assert len(selected_df) == 2
def test__convert_to_timestamp(self): inputs = [ datetime.now(tz.tzlocal()), Timestamp.now(tz.tzlocal()), datetime.now().timestamp() ] for inp in inputs: x = _convert_to_timestamp(inp) self.assertIsInstance(x, (float, int))
def determine_range(self): if len(self.DATE_LIST) > 6: DATE_TO_DISPLAY = self.START_DATE self.DATE_RANGE = [ str(Timestamp(DATE_TO_DISPLAY).to_pydatetime()).split()[0] ] while DATE_TO_DISPLAY < self.DATE_LIST[-1]: DATE_TO_DISPLAY += timedelta(days=7) ts = Timestamp(DATE_TO_DISPLAY).to_pydatetime( ) # convert from 'pandas._libs.tslibs.timestamps.Timestamp' to 'datetime' ts = str(DATE_TO_DISPLAY).split()[0] self.DATE_RANGE.append(ts) else: # self.DATE_RANGE = self.DATE_LIST self.DATE_RANGE = pd.date_range(start=self.DATE_LIST[0], end=self.DATE_LIST[-1], periods=len(self.DATE_LIST)) return self.DATE_RANGE
def test__convert_to_pandas_timestamp_utc(self): inputs = [ datetime.now(tz.tzlocal()), Timestamp.now(tz.tzlocal()), datetime.now().timestamp() ] for inp in inputs: x = _convert_to_pandas_timestamp_utc(inp) self.assertIsInstance(x, Timestamp)
def get_realtime_news(self, freq="day"): while True: if_updated = input( "Has the stock price dataset been updated today? (Y/N) \n") if if_updated == "Y": self.redis_client.set("is_today_updated", "1") break elif if_updated == "N": self.redis_client.set("is_today_updated", "") break self.get_historical_news() # 对所有股票补充数据到最新 while True: if freq == "day": time_now = datetime.datetime.now().strftime( "%Y-%m-%d %H:%M:%S") if time_now.split(" ")[0] != self.redis_client.get( "today_date").decode(): self.redis_client.set("today_date", time_now.split(" ")[0]) self.redis_client.set("is_today_updated", "") # 过了凌晨,该参数设置回空值,表示今天未进行数据更新 if not bool( self.redis_client.get("is_today_updated").decode()): update_time = "{} {}".format( time_now.split(" ")[0], "15:30:00") if time_now >= update_time: stock_zh_a_spot_df = ak.stock_zh_a_spot() # 当天的日数据行情下载 for _id, sym in enumerate( stock_zh_a_spot_df["symbol"]): _col = self.db_obj.get_collection( self.database_name, sym) _tmp_dict = {} _tmp_dict.update({ "date": Timestamp("{} 00:00:00".format( time_now.split(" ")[0])) }) _tmp_dict.update( {"open": stock_zh_a_spot_df.iloc[_id].open}) _tmp_dict.update( {"high": stock_zh_a_spot_df.iloc[_id].high}) _tmp_dict.update( {"low": stock_zh_a_spot_df.iloc[_id].low}) _tmp_dict.update( {"close": stock_zh_a_spot_df.iloc[_id].trade}) _tmp_dict.update({ "volume": stock_zh_a_spot_df.iloc[_id].volume }) _col.insert_one(_tmp_dict) self.redis_client.set(sym, time_now.split(" ")[0]) logging.info( "finished updating {} price data of {} ... ". format(sym, time_now.split(" ")[0])) self.redis_client.set("is_today_updated", "1")
def get_week_range_ext(start_date, end_date, first_week_day=calendar.MONDAY): if not (first_week_day >= calendar.MONDAY and first_week_day <= calendar.SUNDAY): raise ValueError('first_week_day is invalid') if first_week_day == calendar.MONDAY: last_week_day = calendar.SUNDAY else: last_week_day = first_week_day - 1 first_date = Timestamp(start_date) last_date = Timestamp(end_date) ## 根据参数中指定的开始日期和结束日期, 计算出开始日期所在周(星期)的第1天, 结束日期所在周的最后1天 if first_week_day == calendar.MONDAY: first_day_dayofweek_step = first_date.dayofweek last_day_dayofweek_step = (calendar.SUNDAY - last_date.dayofweek) else: if first_date.dayofweek >= first_week_day: first_day_dayofweek_step = first_date.dayofweek - first_week_day else: first_day_dayofweek_step = calendar.SUNDAY - first_week_day + 1 + first_date.dayofweek if last_date.dayofweek >= first_week_day: last_day_dayofweek_step = calendar.SUNDAY - last_date.dayofweek + last_week_day + 1 elif last_date.dayofweek <= last_week_day: last_day_dayofweek_step = last_week_day - last_date.dayofweek first_date = first_date - timedelta(first_day_dayofweek_step) last_date = last_date + timedelta(last_day_dayofweek_step) days = date_range(first_date, last_date) # 计算出每周的开始和结束日期 result_date = [] for i in range(0, len(days), 7): end_index = i + 6 result_date.append([strfdate(days[i]), strfdate(days[end_index])]) logging.debug('{0} - {1}'.format(strfdate(days[i]), strfdate(days[end_index]))) return result_date
def inner_wrapper(*args, **kwargs): has_exception = False exception_str = None exception = None res = None try: res = func(*args, **kwargs) except Exception as e: import traceback exception_str = "{}".format(traceback.format_exc()) has_exception = True exception = e if level == AlarmLevel.ERROR and not has_exception: pass else: new_kwargs = kwargs.copy() new_kwargs['escape_params'] = escape_params params_str = build_params_str(*args, **new_kwargs) if not freq: do_alarm(target if target else func.__name__, level, params_str, res, exception_str) last_alarm_time[target] = Timestamp.now(tz='Asia/Shanghai') else: now = Timestamp.now(tz='Asia/Shanghai') if (target not in last_alarm_time) or ((now - last_alarm_time[target]) > freq): do_alarm(target if target else func.__name__, level, params_str, res, exception_str) last_alarm_time[target] = now else: logging.info("由于频率控制,该告警将不会发出, target:{}, params:{}, res:{}, exception:{}". format(target if target else func.__name__, params_str, res, exception_str)) if has_exception: raise exception else: return res
def find_one(self, name): ts = TimeSeries() r: ModelQuerySet = TimeSeriesModel.objects(name=name) if r.count() == 1: model: TimeSeriesModel = r.first() data_record = {} for key in model.data_record.keys(): dr_model: DataRecordModel = model.data_record[key] data_record[key] = DataRecord( dr_model.code, Timestamp(dr_model.start_time, tz='UTC'), Timestamp(dr_model.end_time, tz='UTC')) ts = TimeSeries(name=model.name, data_record=data_record) elif r.count() > 1: raise RuntimeError("wrong data") # 查找该实例的方法 func: TimeSeriesFunction = TSFunctionRegistry.find_function(name) if not func: raise RuntimeError("没有找到实例方法") ts.with_func(func) return ts
def _convert_to_pandas_timestamp_utc(x): if isinstance(x, (datetime, Timestamp)): assert x.tzinfo, '[TIMEZONE ERROR] We allow operating with timezone-aware datatypes. This helps preventing inconsistency and errors.' x = x.timestamp() if isinstance(x, (float, int)): utc = datetime.utcfromtimestamp(x) utc = utc.replace(tzinfo=tz.tzutc()) utc = Timestamp(utc) return utc raise TypeError( '[TYPE ERROR]: input variable has to be of a type pandas Timestamp, datetime, float, or int. However ' + type(x) + ' recieved.')
def parse_opts(opts): global __excel_files__, __output__, __start_date__, __end_date__, __args_opts__, __my_name__, __config_file__ __args_opts__ = opts args = {arg[2:]: opt for arg, opt in opts} logging.debug('args: {0}'.format(args)) if args.get('excel', None): __my_name__ = 'AAA' __excel_files__[__my_name__] = args['excel'] else: read_config() __excel_files__ = {k: os.path.join(__kpi_path__, v) for k, v in __excel_files__.items()} __output__ = args.get('output', os.getcwd()) args_date = args.get('date', '') if args_date: dates = args_date.split(',') if len(dates) > 1: __start_date__ = dates[0] __end_date__ = dates[1] else: __start_date__ = dates[0] __end_date__ = time.strftime('%Y-%m-%d', time.localtime()) try: Timestamp(__start_date__) Timestamp(__end_date__) except ValueError as e: raise ValueError('参数: --date 格式错误,不是有效的日期格式, 格式:yyyy-mm-dd , {0} {1}'.format( __start_date__, __end_date__ )) else: __start_date__ = __end_date__ = time.strftime('%Y-%m-01', time.localtime()) __end_date__ = __end_date__ = time.strftime('%Y-%m-%d', time.localtime())
def run(self) -> None: while True: try: t: Timestamp = Timestamp.now(tz='Asia/Shanghai') logging.info("当前时间:{}".format(t)) for ed in self.time_event_conditions: if ed.time_rule.is_match(self.calendar, t): event = Event(ed, t, {}) self.subscriber.on_event(event) time.sleep(1) except: import traceback logging.error("{}".format(traceback.format_exc()))
def test_currency_conversion(self): """ Test if the currency is converted correctly original amount: 79.11 USD Conversion rate 2020-10-07 : 1.1053 New amount: 71,57 EUR """ raw_data = { 'Datum': { 0: Timestamp('2020-10-17 00:00:00') }, 'Tijd': { 0: '07:41' }, 'Valutadatum': { 0: '17-10-2021' }, 'Product': { 0: float('nan') }, 'ISIN': { 0: 'IE00B3RBWM25' }, 'Omschrijving': { 0: 'iDEAL Deposit' }, 'FX': { 0: float('nan') }, 'Mutatie': { 0: 'EUR' }, 'Unnamed: 8': { 0: 79.11 }, 'Saldo': { 0: 'USD' }, 'Unnamed: 10': { 0: 37.49 }, 'Order Id': { 0: '123' } } df = pd.DataFrame.from_dict(raw_data) converter = DeGiroConverterAccount(data=df) converter.convert() converted = converter.outputdata[converter.outputdata['ISIN'] == 'IE00B3RBWM25'] self.assertEqual(converted['Value'].iloc[0], 71.57)
def read_excel(name): if not os.path.exists(__excel_file__): print('File not found') return df = pd.read_excel(__excel_file__, sheet_name=name) if __start_date__: start_date = Timestamp(__start_date__) end_date = Timestamp(__end_date__) df = df.loc[(df['日期'] >= start_date) & (df['日期'] <= end_date), :] cols = [r for r in df.columns] rows = [r for r in df.values] records = [{cols[i]: rec[i] for i in range(len(cols))} for rec in rows] #Print records #[logging.debug(r) for r in records] return records
def test_deposit(self): """ Test if the deposit is converted """ raw_data = { 'Datum': { 1: Timestamp('2021-06-01 00:00:00') }, 'Omschrijving': { 1: 'Overschrijving beleggingsrekening' }, 'Valuta': { 1: 'EUR' }, 'Rekeningtype': { 1: 'Gelddeel' }, 'Bedrag': { 1: 1500 }, 'Transactienummer': { 1: 296640628 }, 'Valutadatum': { 1: '2021-06-01' }, 'ING kosten': { 1: 0 }, 'Belasting': { 1: 0 }, 'Rekeningnummer van': { 1: 'Uw Betaalrekening' }, 'Rekeningnummer naar': { 1: 14086338.0 } } df = pd.DataFrame(raw_data) converter = IngConverterAccount(data=df) converter.convert() deposit = converter.outputdata[converter.outputdata['Type'] == 'Deposit'] self.assertEqual(deposit['Value'][1], 1500.00) self.assertEqual(len(deposit), 1)
def test__search_meetings(self, _events_df): _events_df.return_value = pd.DataFrame(self.DATA) ca = CalendarAnalytics(self.user) actual_output = ca._search_meetings(['Standup']).to_dict() expected_output = { 'end_time': { 4: Timestamp('2019-01-11 10:00:00+0530', tz='Asia/Kolkata') }, 'id': { 4: 'sda3cdcasdvasdvasdvas' }, 'start_time': { 4: Timestamp('2019-01-11 10:00:00+0530', tz='Asia/Kolkata') }, 'time_spent': { 4: 3600 }, 'title': { 4: 'Standup catchcup' } } self.assertDictEqual(actual_output, expected_output)
def test_dates_with_only_months_and_years(self): # Datetime with only the month and the year specified (e.g. "1959-01"). # Check that monthly freq is applied. param_config = { "input_parameters": { "source_data_url": os.path.join("test_datasets", "test_5_1.csv"), "columns_to_load_from_url": "first_column,third_column", "datetime_column_name": "first_column", "index_column_name": "first_column", } } df = ingest_timeseries(param_config) assert df.index.name == "first_column" assert df.index.values[0] == Timestamp("1959-01-01") assert df.index.values[1] == Timestamp("1959-02-01") assert df.index.values[2] == Timestamp("1959-03-01") assert df.columns[0] == "third_column" assert df.iloc[0]["third_column"] == 3 assert df.iloc[1]["third_column"] == 6 assert df.iloc[2]["third_column"] == 9 assert df.index.freq == 'MS'