Konuktor92 commited on
Commit
ce7a57d
·
verified ·
1 Parent(s): a5b3fff

backup _backup/scripts 18:14:49

Browse files
Files changed (1) hide show
  1. _backup/scripts/45_package_ca.py +2 -2
_backup/scripts/45_package_ca.py CHANGED
@@ -69,8 +69,8 @@ def main():
69
  shutil.rmtree(tmp)
70
 
71
  # what-if grid: up to 2,000 random eligible cells per region, aggregated to region and country
72
- samp = cells_e.groupby("region", dropna=False, group_keys=False).apply(
73
- lambda g: g.sample(min(len(g), 2000), random_state=0))
74
  rows = []
75
  for mo in MONTHS:
76
  for p in PRECIP:
 
69
  shutil.rmtree(tmp)
70
 
71
  # what-if grid: up to 2,000 random eligible cells per region, aggregated to region and country
72
+ shuffled = cells_e.sample(frac=1.0, random_state=0)
73
+ samp = shuffled[shuffled.groupby("region", dropna=False).cumcount() < 2000]
74
  rows = []
75
  for mo in MONTHS:
76
  for p in PRECIP: