108108 example of a valid callable argument would be ``lambda x: x.upper() in
109109 ['AAA', 'BBB', 'DDD']``. Using this parameter results in much faster
110110 parsing time and lower memory usage.
111- as_recarray : boolean, default False
112- .. deprecated:: 0.19.0
113- Please call `pd.read_csv(...).to_records()` instead.
114-
115- Return a NumPy recarray instead of a DataFrame after parsing the data.
116- If set to True, this option takes precedence over the `squeeze` parameter.
117- In addition, as row indices are not available in such a format, the
118- `index_col` parameter will be ignored.
119111squeeze : boolean, default False
120112 If the parsed data only contains one column then return a Series
121113prefix : str, default None
@@ -506,7 +498,6 @@ def _read(filepath_or_buffer, kwds):
506498
507499_c_parser_defaults = {
508500 'delim_whitespace' : False ,
509- 'as_recarray' : False ,
510501 'na_filter' : True ,
511502 'compact_ints' : False ,
512503 'use_unsigned' : False ,
@@ -532,14 +523,12 @@ def _read(filepath_or_buffer, kwds):
532523}
533524
534525_deprecated_defaults = {
535- 'as_recarray' : None ,
536526 'buffer_lines' : None ,
537527 'compact_ints' : None ,
538528 'use_unsigned' : None ,
539529 'tupleize_cols' : None
540530}
541531_deprecated_args = {
542- 'as_recarray' ,
543532 'buffer_lines' ,
544533 'compact_ints' ,
545534 'use_unsigned' ,
@@ -614,7 +603,6 @@ def parser_f(filepath_or_buffer,
614603 # Internal
615604 doublequote = True ,
616605 delim_whitespace = False ,
617- as_recarray = None ,
618606 compact_ints = None ,
619607 use_unsigned = None ,
620608 low_memory = _c_parser_defaults ['low_memory' ],
@@ -685,7 +673,6 @@ def parser_f(filepath_or_buffer,
685673 compact_ints = compact_ints ,
686674 use_unsigned = use_unsigned ,
687675 delim_whitespace = delim_whitespace ,
688- as_recarray = as_recarray ,
689676 warn_bad_lines = warn_bad_lines ,
690677 error_bad_lines = error_bad_lines ,
691678 low_memory = low_memory ,
@@ -971,9 +958,7 @@ def _clean_options(self, options, engine):
971958 "and will be removed in a future version."
972959 .format (arg = arg ))
973960
974- if arg == 'as_recarray' :
975- msg += ' Please call pd.to_csv(...).to_records() instead.'
976- elif arg == 'tupleize_cols' :
961+ if arg == 'tupleize_cols' :
977962 msg += (' Column tuples will then '
978963 'always be converted to MultiIndex.' )
979964
@@ -1059,9 +1044,6 @@ def read(self, nrows=None):
10591044
10601045 ret = self ._engine .read (nrows )
10611046
1062- if self .options .get ('as_recarray' ):
1063- return ret
1064-
10651047 # May alter columns / col_dict
10661048 index , columns , col_dict = self ._create_index (ret )
10671049
@@ -1279,7 +1261,6 @@ def __init__(self, kwds):
12791261
12801262 self .true_values = kwds .get ('true_values' )
12811263 self .false_values = kwds .get ('false_values' )
1282- self .as_recarray = kwds .get ('as_recarray' , False )
12831264 self .tupleize_cols = kwds .get ('tupleize_cols' , False )
12841265 self .mangle_dupe_cols = kwds .get ('mangle_dupe_cols' , True )
12851266 self .infer_datetime_format = kwds .pop ('infer_datetime_format' , False )
@@ -1295,9 +1276,6 @@ def __init__(self, kwds):
12951276 if isinstance (self .header , (list , tuple , np .ndarray )):
12961277 if not all (map (is_integer , self .header )):
12971278 raise ValueError ("header must be integer or list of integers" )
1298- if kwds .get ('as_recarray' ):
1299- raise ValueError ("cannot specify as_recarray when "
1300- "specifying a multi-index header" )
13011279 if kwds .get ('usecols' ):
13021280 raise ValueError ("cannot specify usecols when "
13031281 "specifying a multi-index header" )
@@ -1900,10 +1878,6 @@ def read(self, nrows=None):
19001878 # Done with first read, next time raise StopIteration
19011879 self ._first_chunk = False
19021880
1903- if self .as_recarray :
1904- # what to do if there are leading columns?
1905- return data
1906-
19071881 names = self .names
19081882
19091883 if self ._reader .leading_cols :
@@ -2306,9 +2280,6 @@ def read(self, rows=None):
23062280 columns , data = self ._do_date_conversions (columns , data )
23072281
23082282 data = self ._convert_data (data )
2309- if self .as_recarray :
2310- return self ._to_recarray (data , columns )
2311-
23122283 index , columns = self ._make_index (data , alldata , columns , indexnamerow )
23132284
23142285 return index , columns , data
@@ -2376,19 +2347,6 @@ def _clean_mapping(mapping):
23762347 clean_na_fvalues , self .verbose ,
23772348 clean_conv , clean_dtypes )
23782349
2379- def _to_recarray (self , data , columns ):
2380- dtypes = []
2381- o = compat .OrderedDict ()
2382-
2383- # use the columns to "order" the keys
2384- # in the unordered 'data' dictionary
2385- for col in columns :
2386- dtypes .append ((str (col ), data [col ].dtype ))
2387- o [col ] = data [col ]
2388-
2389- tuples = lzip (* o .values ())
2390- return np .array (tuples , dtypes )
2391-
23922350 def _infer_columns (self ):
23932351 names = self .names
23942352 num_original_columns = 0
0 commit comments