Hy peeps,
I wold like to know if have some possibility to use a function at the result of pandas .loc
or if exist some better way to do it.
So what I'm trying to do is:
If the value in this series is =!0, then get the values of other rows and use as parameters for one function (in this case, get_working_days_delta), after this put the result in the same series.
df.loc[(df["SERIES"] != 0), 'SERIES'] = df.apply(cal.get_working_days_delta(df["DATE_1"],df["DATE_2"]))
The output is: datetime64[ns] is of unsupported type (<class 'pandas.core.series.Series'>)
In this case, the parameters used (df["DATE_1"] df["DATE_2"])
are recognized as the entire series rather than cell values
I don't wanna use .apply
or .at
because this df has over 4 milion rows
source https://stackoverflow.com/questions/74166376/use-a-function-at-the-result-of-pandas-loc
Comments
Post a Comment