From eb042da8ac7060139c2f6ede2fbe251eecfcc9bc Mon Sep 17 00:00:00 2001 From: shaunwbell Date: Thu, 31 Oct 2024 08:02:31 -0700 Subject: [PATCH] python 3.12 string updates --- src/EcoFOCIpy/io/rcm_parser.py | 2 +- src/EcoFOCIpy/io/sbe_parser.py | 6 +++--- src/EcoFOCIpy/io/wetlabs_parser.py | 2 +- src/EcoFOCIpy/io/wpak_parser.py | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/EcoFOCIpy/io/rcm_parser.py b/src/EcoFOCIpy/io/rcm_parser.py index 216e56f..0680da3 100644 --- a/src/EcoFOCIpy/io/rcm_parser.py +++ b/src/EcoFOCIpy/io/rcm_parser.py @@ -62,7 +62,7 @@ def parse(self, filename=None, number_of_channels=8, time_format=0, datetime_ind else: headernames=['sample','date','time','ident','speed_engr','dir_engr','temp_engr','cond_engr','press_engr'] - rawdata_df = pd.read_csv(filename, names=headernames, delimiter="\s+",) + rawdata_df = pd.read_csv(filename, names=headernames, delimiter=r'\s+',) if time_format == 0: rawdata_df["date_time"] = pd.to_datetime( rawdata_df['date'] + " " + rawdata_df['time'], format="%m/%d/%Y %H:%M:%S" diff --git a/src/EcoFOCIpy/io/sbe_parser.py b/src/EcoFOCIpy/io/sbe_parser.py index 67eaf74..8054635 100644 --- a/src/EcoFOCIpy/io/sbe_parser.py +++ b/src/EcoFOCIpy/io/sbe_parser.py @@ -76,7 +76,7 @@ def parse(filename=None, return_header=True, datetime_index=True): rawdata_df = pd.read_csv(filename, - delimiter="\s+", + delimiter=r'\s+', parse_dates=True, header=None, names=var_names.values(), @@ -131,7 +131,7 @@ def parse(filename=None, datetime_index=True): assert filename.split('.')[-1] == 'tid' , 'Must provide a tid file - use sbe software to convert' rawdata_df = pd.read_csv(filename, - delimiter="\s+", + delimiter=r'\s+', skiprows=1, names=["date", "time", "pressure", "temperature"]) @@ -289,7 +289,7 @@ def parse(filename=None, return_header=True, datetime_index=True): rawdata_df = pd.read_csv(filename, - delimiter="\s+", + delimiter=r'\s+', parse_dates=True, header=None, names=var_names.values(), diff --git a/src/EcoFOCIpy/io/wetlabs_parser.py b/src/EcoFOCIpy/io/wetlabs_parser.py index d7eb38f..e4e3f69 100644 --- a/src/EcoFOCIpy/io/wetlabs_parser.py +++ b/src/EcoFOCIpy/io/wetlabs_parser.py @@ -52,7 +52,7 @@ def parse(self, filename=None, return_header=True, datetime_index=True): rawdata_df = pd.read_csv(filename, - delimiter="\s+", + delimiter=r'\s+', parse_dates=True, header=None, skiprows=headercount) diff --git a/src/EcoFOCIpy/io/wpak_parser.py b/src/EcoFOCIpy/io/wpak_parser.py index bbab330..ab47455 100644 --- a/src/EcoFOCIpy/io/wpak_parser.py +++ b/src/EcoFOCIpy/io/wpak_parser.py @@ -33,7 +33,7 @@ def parse(filename=None, argos_file=False, datetime_index=True): """ assert filename != None , 'Must provide a datafile' - rawdata_df = pd.read_csv(filename, header=0, delimiter="\s+") + rawdata_df = pd.read_csv(filename, header=0, delimiter=r'\s+') rawdata_df["date_time"] = pd.to_datetime( rawdata_df["DATE"] + " " + rawdata_df["TIME"], format="%y/%m/%d %H:%M:%S" )