14

Each of your if blocks does the same thing, but with different inputs. if sun == 1: first_sunday = np.busday_offset(start, 0, roll='forward', weekmask='Sun') last_sunday = np.busday_offset(end, 0, roll='preceding', weekmask='Sun') sun_count = np.busday_count(first_sunday, last_sunday, weekmask='Sun') + 1 for i in trange(...


Only top voted, non community-wiki answers of a minimum length are eligible