Python Forum
Remove values for weekend in a panda series
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Remove values for weekend in a panda series
#1
Hi

I have a range of daily values. I want to remove the weekend (Sat + Sun) period and the accompanying values. How do I do so?

df=pd.read_excel(input_file, sheet_name='daily', usecols='A:D', na_values='ND', index_col=0, header=0)
df.index.names = ['Period']
df.index = pd.to_datetime(df.index)

q= pd.Series(df['Values'], index=df.index)
Period Values
20-Jan-89 3
27-Jan-89 4
3-Feb-89 2
10-Feb-89 5
17-Feb-89 3
24-Feb-89 5
3-Mar-89 5
10-Mar-89 6
17-Mar-89 4
24-Mar-89 5
31-Mar-89 7
7-Apr-89 6
14-Apr-89 6
21-Apr-89 4
28-Apr-89 7
5-May-89 5
12-May-89 6
19-May-89 5
26-May-89 7
2-Jun-89 7
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  find the sum of a series of values that equal a number ancorte 1 461 Oct-30-2023, 05:41 AM
Last Post: Gribouillis
  Print names in x-axis of a time-series values hobbyist 4 1,176 Apr-22-2023, 09:29 PM
Last Post: deanhystad
  Panda pivot_table questions dee 1 715 Jan-09-2023, 05:45 PM
Last Post: dee
  panda table data kucingkembar 0 1,073 Mar-01-2022, 10:38 PM
Last Post: kucingkembar
  Remove if similar values available based on two columns klllmmm 1 1,313 Feb-20-2022, 06:55 PM
Last Post: Larz60+
  Convert quarterly time series to monthly time series donnertrud 1 5,097 May-22-2020, 10:16 AM
Last Post: pyzyx3qwerty
  can we write command output to new csv file using Panda package? PythonBeginner_2020 3 2,322 Mar-13-2020, 12:38 PM
Last Post: ndc85430
  Remove \n from list of values within a pandas columns klllmmm 2 14,153 Jun-24-2019, 05:16 AM
Last Post: klllmmm
  Header above a list in Panda sweet_swiss 3 2,921 Aug-12-2018, 11:03 PM
Last Post: scidam
  Replace only '-' values with NaN, don't remove minus sign for negative numbers. rajpython 2 5,990 Sep-10-2017, 01:23 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020