File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -312,13 +312,15 @@ def function(datum):
312312 if numpy is not None :
313313 context ["numpy" ] = numpy
314314 context ["np" ] = numpy
315+ major = int (numpy .__version__ .split ('.' )[0 ])
316+ npcore = numpy ._core if major > 1 else numpy .core
315317
316318 # if the datum is a dict, override the namespace with its dict keys
317319 if isinstance (datum , dict ): # if it's a dict
318320 context .update (datum ) # use its items as variables
319321
320322 # if the datum is a Numpy record array, override the namespace with its field names
321- elif numpy is not None and isinstance (datum , numpy . _core .records .recarray ):
323+ elif numpy is not None and isinstance (datum , npcore .records .recarray ):
322324 context .update (dict ((n , datum [n ]) for n in datum .dtype .names ))
323325
324326 # if the datum is a Pandas DataFrame, override the namespace with its column names
You can’t perform that action at this time.
0 commit comments