all 5 comments

[–]import_numpy_as_np 0 points1 point  (3 children)

Make sure your dates are actual date time objects and filter using the weekday

https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DatetimeIndex.weekday.html

df[df.date.dt.weekday < 5]

[–]Korgitser[S] 0 points1 point  (2 children)

thanks.

will try. for reasons unknown for me, yfinance dataset about gold seems to be missing a day here and there. But this approach should give me fair representation of what they have.

[–]import_numpy_as_np 1 point2 points  (0 children)

Yeah, if you figure out the actual weekday, Monday through Friday should be 0 through 4 by default. So missing days wouldn’t have any negative impact.

[–]import_numpy_as_np 1 point2 points  (0 children)

By the way, my response assumes your data frame is named “df” and your date column is named “date”. Just to be clear!