Skip to content

Conversation

@SauersML
Copy link

@SauersML SauersML commented Apr 2, 2024

Changes Made:

  1. Pandas Timedelta Deprecation Warning:

    • Updated the use of "S" to "s" in pd.Timedelta to conform to the upcoming deprecation in pandas. This change fixes the FutureWarning regarding the deprecation of 'S' in favor of 's' for specifying seconds in pd.Timedelta.
    # Before:
    has_live_indice = index_utc[-1] >= last_trade - pd.Timedelta(2, "S")
    
    # After:
    has_live_indice = index_utc[-1] >= last_trade - pd.Timedelta(2, "s")
  2. Chained Assignment Warning:

    • Altered the approach to setting values in the DataFrame to avoid chained assignment, which is not recommended due to its unclear behavior in certain contexts (operations that behave as if they were on a copy.). This adjustment is in response to pandas' future change in how inplace=True will function.
    # Before:
    df["dividends"].fillna(0, inplace=True)

...
df["splits"].fillna(0, inplace=True)

After:

df["dividends"] = df["dividends"].fillna(0)
...
df["splits"] = df["splits"].fillna(0)

@SauersML SauersML mentioned this pull request Apr 2, 2024
@maread99
Copy link
Collaborator

maread99 commented Apr 2, 2024

I believe this is a duplicate of #262, only difference being that this overwrites the 'dividends' and 'split' columns as opposed to undertaking the fillna operation in place. Changes in #262 are in line with the advices offered in the deprecation warning, although seems this PR would also do the trick.

@maread99
Copy link
Collaborator

Fixed in v2.4.0 by #316.

@maread99 maread99 closed this May 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants