From 1908b791c17a771674826416192b4f9f8ac55d78 Mon Sep 17 00:00:00 2001
From: luenensc <peter.luenenschloss@ufz.de>
Date: Sun, 3 Mar 2024 18:14:31 +0100
Subject: [PATCH] added pandas index support for setFlags

---
 saqc/funcs/flagtools.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/saqc/funcs/flagtools.py b/saqc/funcs/flagtools.py
index 783ad6c2c..9e01e74e2 100644
--- a/saqc/funcs/flagtools.py
+++ b/saqc/funcs/flagtools.py
@@ -108,7 +108,7 @@ class FlagtoolsMixin:
         data :
             Determines which timestamps to set flags at, depending on the passed type:
 
-            * 1-d `array` or `List` of timestamps: flag `field` with `flag` at every timestamp in `f_data`
+            * 1-d `array` or `List` of timestamps or `pandas.Index`: flag `field` with `flag` at every timestamp in `f_data`
             * 2-d `array` or List of tuples: for all elements `t[k]` out of f_data:
               flag `field` with `flag` at every timestamp in between `t[k][0]` and `t[k][1]`
             * pd.Series: flag `field` with `flag` in between any index and data value of the passed series
@@ -123,7 +123,7 @@ class FlagtoolsMixin:
         to_flag = pd.Series(False, index=self._data[field].index)
 
         # check if f_data is meant to denote timestamps:
-        if (isinstance(data, (list, np.ndarray))) and not isinstance(
+        if (isinstance(data, (list, np.ndarray, pd.Index))) and not isinstance(
             data[0], (tuple, np.ndarray)
         ):
             set_idx = pd.DatetimeIndex(data).intersection(to_flag.index)
-- 
GitLab