@@ -428,7 +428,7 @@ def _get_take_1d_function(dtype, out_dtype):
428
428
except KeyError :
429
429
pass
430
430
431
- if dtype != out_dtype :
431
+ if dtype != out_dtype :
432
432
try :
433
433
func = _take_1d_dict [out_dtype .name , out_dtype .name ]
434
434
return _convert_wrapper (func , out_dtype )
@@ -454,7 +454,7 @@ def _get_take_2d_function(dtype, out_dtype, axis=0):
454
454
except KeyError :
455
455
pass
456
456
457
- if dtype != out_dtype :
457
+ if dtype != out_dtype :
458
458
try :
459
459
if axis == 0 :
460
460
func = _take_2d_axis0_dict [out_dtype .name , out_dtype .name ]
@@ -686,7 +686,7 @@ def _maybe_upcast(values):
686
686
elif issubclass (values .dtype .type , np .bool_ ):
687
687
values = values .astype (np .object_ )
688
688
return values
689
-
689
+
690
690
691
691
def _interp_wrapper (f , wrap_dtype , na_override = None ):
692
692
def wrapper (arr , mask , limit = None ):
@@ -824,7 +824,7 @@ def _possibly_convert_objects(values, convert_dates=True, convert_numeric=True):
824
824
if values .dtype == np .object_ and convert_numeric :
825
825
try :
826
826
new_values = lib .maybe_convert_numeric (values ,set (),coerce_numeric = True )
827
-
827
+
828
828
# if we are all nans then leave me alone
829
829
if not isnull (new_values ).all ():
830
830
values = new_values
@@ -923,9 +923,7 @@ def _is_bool_indexer(key):
923
923
def _default_index (n ):
924
924
from pandas .core .index import Int64Index
925
925
values = np .arange (n , dtype = np .int64 )
926
- result = values .view (Int64Index )
927
- result .name = None
928
- return result
926
+ return Int64Index (values )
929
927
930
928
931
929
def ensure_float (arr ):
@@ -1072,7 +1070,7 @@ def _long_prod(vals):
1072
1070
result *= x
1073
1071
return result
1074
1072
1075
-
1073
+
1076
1074
class groupby (dict ):
1077
1075
"""
1078
1076
A simple groupby different from the one in itertools.
@@ -1137,10 +1135,10 @@ def _shift_indexer(N, periods):
1137
1135
def _asarray_tuplesafe (values , dtype = None ):
1138
1136
from pandas .core .index import Index
1139
1137
1140
- if not isinstance (values , (list , tuple , np .ndarray )):
1141
- values = list (values )
1142
- elif isinstance (values , Index ):
1138
+ if isinstance (values , Index ):
1143
1139
return values .values
1140
+ elif not isinstance (values , (list , tuple , np .ndarray )):
1141
+ values = list (values )
1144
1142
1145
1143
if isinstance (values , list ) and dtype in [np .object_ , object ]:
1146
1144
return lib .list_to_object_array (values )
0 commit comments