File tree 1 file changed +8
-7
lines changed
1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -131,13 +131,6 @@ def maybe_downcast_to_dtype(result, dtype):
131
131
elif isinstance (result , ABCDataFrame ):
132
132
# occurs in pivot_table doctest
133
133
return result
134
- elif dtype .type is Period :
135
- from pandas .core .arrays import PeriodArray
136
-
137
- with suppress (TypeError ):
138
- # e.g. TypeError: int() argument must be a string, a
139
- # bytes-like object or a number, not 'Period
140
- return PeriodArray (result , freq = dtype .freq )
141
134
142
135
if isinstance (dtype , str ):
143
136
if dtype == "infer" :
@@ -162,6 +155,14 @@ def maybe_downcast_to_dtype(result, dtype):
162
155
163
156
dtype = np .dtype (dtype )
164
157
158
+ elif dtype .type is Period :
159
+ from pandas .core .arrays import PeriodArray
160
+
161
+ with suppress (TypeError ):
162
+ # e.g. TypeError: int() argument must be a string, a
163
+ # bytes-like object or a number, not 'Period
164
+ return PeriodArray (result , freq = dtype .freq )
165
+
165
166
converted = maybe_downcast_numeric (result , dtype , do_round )
166
167
if converted is not result :
167
168
return converted
You can’t perform that action at this time.
0 commit comments