How can I fix the warning:
FutureWarning: 'T' is deprecated and will be removed in a future version. Please use 'min' instead of 'T'.
if median_diff > pd.Timedelta(freq):
In the method below it comes up every time I run it but I am not using a T in my code that I can see:
@staticmethod
def apply_rolling_average_if_needed(df, freq="1min", rolling_window="5min"):
""" Apply rolling average if time difference between consecutive
timestamps is not greater than the specified frequency.
"""
print("Warning: If data has a one minute or less sampling frequency a rolling average will be automatically applied")
sys.stdout.flush()
time_diff = df.index.to_series().diff().iloc[1:]
# Calculate median time difference to avoid being affected by outliers
median_diff = time_diff.median()
print(f"Warning: Median time difference between consecutive timestamps is {median_diff}.")
sys.stdout.flush()
if median_diff > pd.Timedelta(freq):
print(f"Warning: Skipping any rolling averaging...")
sys.stdout.flush()
else:
df = df.rolling(rolling_window).mean()
print(f"Warning: A {rolling_window} rolling average has been applied to the data.")
sys.stdout.flush()
return df
apply_rolling_average_if_needed(frame, freq="1T")(or similar) somewherefreq="1T"in the call should befreq="1min". Why did you say you're not usingTin the code?apply_rolling_average_if_needed(frame, freq="1T")in my code base