@@ -1543,41 +1543,6 @@ def safe_isinf(x):
15431543 return b
15441544
15451545
1546- @cbook .deprecated ("2.2" )
1547- def rec_append_fields (rec , names , arrs , dtypes = None ):
1548- """
1549- Return a new record array with field names populated with data
1550- from arrays in *arrs*. If appending a single field, then *names*,
1551- *arrs* and *dtypes* do not have to be lists. They can just be the
1552- values themselves.
1553- """
1554- if (not isinstance (names , str ) and np .iterable (names )
1555- and len (names ) and isinstance (names [0 ], str )):
1556- if len (names ) != len (arrs ):
1557- raise ValueError ("number of arrays do not match number of names" )
1558- else : # we have only 1 name and 1 array
1559- names = [names ]
1560- arrs = [arrs ]
1561- arrs = list (map (np .asarray , arrs ))
1562- if dtypes is None :
1563- dtypes = [a .dtype for a in arrs ]
1564- elif not np .iterable (dtypes ):
1565- dtypes = [dtypes ]
1566- if len (arrs ) != len (dtypes ):
1567- if len (dtypes ) == 1 :
1568- dtypes = dtypes * len (arrs )
1569- else :
1570- raise ValueError ("dtypes must be None, a single dtype or a list" )
1571- old_dtypes = rec .dtype .descr
1572- newdtype = np .dtype (old_dtypes + list (zip (names , dtypes )))
1573- newrec = np .recarray (rec .shape , dtype = newdtype )
1574- for field in rec .dtype .fields :
1575- newrec [field ] = rec [field ]
1576- for name , arr in zip (names , arrs ):
1577- newrec [name ] = arr
1578- return newrec
1579-
1580-
15811546@cbook .deprecated ("2.2" )
15821547def csv2rec (fname , comments = '#' , skiprows = 0 , checkrows = 0 , delimiter = ',' ,
15831548 converterd = None , names = None , missing = '' , missingd = None ,
0 commit comments