Python Forum
looping for time while skipping a day
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
looping for time while skipping a day
#1
So I have a dailiy time series of len 20311,

I want to create a loop as which increases by 365 but skiping on day as follows

pick the 0:365, 367:732, 734:1099, 1101:1466 etc etc..

I would be glad if someone can help with this looping.

Thanks
Reply
#2
0:365 does that mean 0 up to 365 included [0,1,....,364,365] -> length 366
or does it mean 365 not included [0,1,...363,364]? -> length 365
Usually in Python slicing does not include the end index.
So what index do you want to skip?
for idx in range(20311//366): # or //365  or //367?
    pick = series[idx*367:(idx+1)*367-2] # skipping 2
    pick = series[idx*367:(idx+1)*367-1] # skipping 1
Reply
#3
Thanks for your suggestion, works well
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  File loop curiously skipping files - FIXED mbk34 10 685 Feb-10-2024, 07:08 AM
Last Post: buran
  Skipping line in text without Restarting Loop IdMineThat 4 1,433 Apr-05-2022, 04:23 AM
Last Post: deanhystad
  python seems to be skipping lines of code alansandbucket 1 4,088 Jun-22-2021, 01:18 AM
Last Post: Larz60+
  Convert looping home security to a one time scan of switches and sensors duckredbeard 0 1,722 Dec-08-2020, 04:31 AM
Last Post: duckredbeard
  Skipping Strings Kristenl2784 0 1,463 Jul-27-2020, 06:01 PM
Last Post: Kristenl2784
  Skipping Loop blueriver649 4 2,766 Apr-18-2019, 04:11 AM
Last Post: blueriver649
  When I read csv file i am getting b'Skipping line messages GuJu 4 10,279 Mar-07-2019, 11:47 AM
Last Post: GuJu
  For loop question(skipping) jure98 1 2,435 Mar-31-2018, 01:54 PM
Last Post: Larz60+
  Game inputs skipping Azazel 2 3,916 May-25-2017, 02:29 PM
Last Post: Azazel

Forum Jump:

User Panel Messages

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