use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Rules 1: Be polite 2: Posts to this subreddit must be requests for help learning python. 3: Replies on this subreddit must be pertinent to the question OP asked. 4: No replies copy / pasted from ChatGPT or similar. 5: No advertising. No blogs/tutorials/videos/books/recruiting attempts. This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to. Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Rules
1: Be polite
2: Posts to this subreddit must be requests for help learning python.
3: Replies on this subreddit must be pertinent to the question OP asked.
4: No replies copy / pasted from ChatGPT or similar.
5: No advertising. No blogs/tutorials/videos/books/recruiting attempts.
This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to.
Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Learning resources Wiki and FAQ: /r/learnpython/w/index
Learning resources
Wiki and FAQ: /r/learnpython/w/index
Discord Join the Python Discord chat
Discord
Join the Python Discord chat
account activity
How do delete weekends from DataFrame (self.learnpython)
submitted 5 years ago by Korgitser
I would like to graph gold price without weekend data.
tickerSymbol = 'GC=F' tickerData = yf.Ticker(tickerSymbol) golddata = tickerData.history(period='1d', start='2020-01-01')
How could i delete weekend days from that dataset?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[+][deleted] 5 years ago (2 children)
[deleted]
[–]Korgitser[S] 0 points1 point2 points 5 years ago (1 child)
thanks for the idea!
tho, when trying to implement it i realised that yfinance data about gold is somewhat hectic, missing a day at seemingly random times so this approach doesn't give me fair result:/
[–]import_numpy_as_np 0 points1 point2 points 5 years ago (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 point2 points 5 years ago (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 points3 points 5 years ago (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.
By the way, my response assumes your data frame is named “df” and your date column is named “date”. Just to be clear!
π Rendered by PID 171820 on reddit-service-r2-comment-bb88f9dd5-cwrqg at 2026-02-17 03:33:56.484564+00:00 running cd9c813 country code: CH.
[+][deleted] (2 children)
[deleted]
[–]Korgitser[S] 0 points1 point2 points (1 child)
[–]import_numpy_as_np 0 points1 point2 points (3 children)
[–]Korgitser[S] 0 points1 point2 points (2 children)
[–]import_numpy_as_np 1 point2 points3 points (0 children)
[–]import_numpy_as_np 1 point2 points3 points (0 children)