Package: nortech
nortech-pythonThe official Python library for Nortech AI.InstallYou can install using pip:pipinstallnortechOr if you are using poetry:poetryaddnortechS3ConfigSetup your environment variables with theAWS_ACCESS_KEY_IDandAWS_SECRET_ACCESS_KEYprovided to you:exportAWS_ACCESS_KEY_ID="<AWS_ACCESS_KEY_ID>"exportAWS_SECRET_ACCESS_KEY="<AWS_SECRET_ACCESS_KEY>"If you have anAWS_SESSION_TOKENinstead:exportAWS_SESSION_TOKEN="<AWS_SESSION_TOKEN>"As an alternative you can use theAWS CLI:awsconfigureExamplesTo get a DataFrame with the requested signals:Go to yourSignal Searchinterface.Select the desired signals.Select theDataToolsexported columns and copy the resultingsearch_json.Use thesearch_jsonand speficy aTimeWindowas in the examples bellow.Pandas DataFrameIn order to get apandasDataFrame use theget_df:fromdatetimeimportdatetimefromnortech.datatoolsimportget_df,TimeWindowsearch_json="""[{"name": "signal_1","dataType": "float","alias": 0,"asset": {"name": "asset_1"},"division": {"name": "division_1"},"unit": {"name": "unit_1"},"storage": {"bucket": "nortech-test","path": "scope_1_group_0"}},{"name": "signal_2","dataType": "float","alias": 1,"asset": {"name": "asset_1"},"division": {"name": "division_1"},"unit": {"name": "unit_1"},"storage": {"bucket": "nortech-test","path": "scope_1_group_0"}},{"name": "signal_3","dataType": "float","alias": 0,"asset": {"name": "asset_2"},"division": {"name": "division_2"},"unit": {"name": "unit_2"},"storage": {"bucket": "nortech-test","path": "scope_1_group_1"}}]"""time_window=TimeWindow(start=datetime(2020,1,1),end=datetime(2020,1,5),)df=get_df(search_json=search_json,time_window=time_window)assertlist(df.columns)==['timestamp','asset_1/division_1/unit_1/signal_1','asset_1/division_1/unit_1/signal_2','asset_2/division_2/unit_2/signal_3']Polars DataFrameIn order to get apolarsDataFrame use theget_polars_df:fromdatetimeimportdatetimefromnortech.datatoolsimportget_polars_df,TimeWindowsearch_json="""[{"name": "signal_1","dataType": "float","alias": 0,"asset": {"name": "asset_1"},"division": {"name": "division_1"},"unit": {"name": "unit_1"},"storage": {"bucket": "nortech-test","path": "scope_1_group_0"}},{"name": "signal_2","dataType": "float","alias": 1,"asset": {"name": "asset_1"},"division": {"name": "division_1"},"unit": {"name": "unit_1"},"storage": {"bucket": "nortech-test","path": "scope_1_group_0"}},{"name": "signal_3","dataType": "float","alias": 0,"asset": {"name": "asset_2"},"division": {"name": "division_2"},"unit": {"name": "unit_2"},"storage": {"bucket": "nortech-test","path": "scope_1_group_1"}}]"""time_window=TimeWindow(start=datetime(2020,1,1),end=datetime(2020,1,5),)polars_df=get_polars_df(search_json=search_json,time_window=time_window)assertpolars_df.columns==['timestamp','asset_1/division_1/unit_1/signal_1','asset_1/division_1/unit_1/signal_2','asset_2/division_2/unit_2/signal_3']Polars LazyFrameIn order to get apolarsLazyFrame use theget_lazy_polars_df:fromdatetimeimportdatetimefromnortech.datatoolsimportget_lazy_polars_df,TimeWindowsearch_json="""[{"name": "signal_1","dataType": "float","alias": 0,"asset": {"name": "asset_1"},"division": {"name": "division_1"},"unit": {"name": "unit_1"},"storage": {"bucket": "nortech-test","path": "scope_1_group_0"}},{"name": "signal_2","dataType": "float","alias": 1,"asset": {"name": "asset_1"},"division": {"name": "division_1"},"unit": {"name": "unit_1"},"storage": {"bucket": "nortech-test","path": "scope_1_group_0"}},{"name": "signal_3","dataType": "float","alias": 0,"asset": {"name": "asset_2"},"division": {"name": "division_2"},"unit": {"name": "unit_2"},"storage": {"bucket": "nortech-test","path": "scope_1_group_1"}}]"""time_window=TimeWindow(start=datetime(2020,1,1),end=datetime(2020,1,5),)lazy_polars_df=get_lazy_polars_df(search_json=search_json,time_window=time_window)assertlazy_polars_df.columns==['timestamp','asset_1/division_1/unit_1/signal_1','asset_1/division_1/unit_1/signal_2','asset_2/division_2/unit_2/signal_3']