Python Forum
Moving to Functional
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Moving to Functional
#9
A quick fix is to not use numpy
from functools import reduce
import itertools as itt

ZERO = [0] * 10

def add_list(a, b):
    return [x + y for x, y in zip(a, b)]

    
def count_incr(rec):
    return [RecRan(rec, j) for j in range(10)]
 
def ireport_group(date, irec):
    return itt.chain(
        (StrRec(rec) for rec in irec),
        (Summary(
            len(irec),
            reduce(add_list, (count_incr(rec) for rec in irec), ZERO),
            Strdate(date)),))

def Report():
    return ''.join(
        itt.chain.from_iterable(
            ireport_group(date, list(irec))
                for date, irec in itt.groupby(Load(), key=RecToDate)))
Another solution is probably to install numpy 1.19.3 as suggested in the dev page that you linked.
Reply


Messages In This Thread
Moving to Functional - by swisscheese - Dec-13-2020, 09:30 PM
RE: Moving to Functional - by Gribouillis - Dec-14-2020, 08:56 AM
RE: Moving to Functional - by swisscheese - Dec-14-2020, 01:41 PM
RE: Moving to Functional - by swisscheese - Dec-14-2020, 09:22 PM
RE: Moving to Functional - by Gribouillis - Dec-15-2020, 05:26 AM
RE: Moving to Functional - by swisscheese - Dec-15-2020, 10:27 AM
RE: Moving to Functional - by Gribouillis - Dec-15-2020, 05:45 PM
RE: Moving to Functional - by swisscheese - Dec-15-2020, 08:08 PM
RE: Moving to Functional - by Gribouillis - Dec-15-2020, 08:42 PM
RE: Moving to Functional - by ndc85430 - Dec-16-2020, 07:09 AM
RE: Moving to Functional - by Gribouillis - Dec-16-2020, 07:52 AM
RE: Moving to Functional - by swisscheese - Dec-17-2020, 12:57 PM

Forum Jump:

User Panel Messages

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