@@ -136,7 +136,7 @@ def trans(x): # noqa
136
136
try :
137
137
if np .allclose (new_result , result , rtol = 0 ):
138
138
return new_result
139
- except :
139
+ except Exception :
140
140
141
141
# comparison of an object dtype with a number type could
142
142
# hit here
@@ -151,14 +151,14 @@ def trans(x): # noqa
151
151
elif dtype .kind in ['M' , 'm' ] and result .dtype .kind in ['i' , 'f' ]:
152
152
try :
153
153
result = result .astype (dtype )
154
- except :
154
+ except Exception :
155
155
if dtype .tz :
156
156
# convert to datetime and change timezone
157
157
from pandas import to_datetime
158
158
result = to_datetime (result ).tz_localize ('utc' )
159
159
result = result .tz_convert (dtype .tz )
160
160
161
- except :
161
+ except Exception :
162
162
pass
163
163
164
164
return result
@@ -210,7 +210,7 @@ def changeit():
210
210
new_result [mask ] = om_at
211
211
result [:] = new_result
212
212
return result , False
213
- except :
213
+ except Exception :
214
214
pass
215
215
216
216
# we are forced to change the dtype of the result as the input
@@ -243,7 +243,7 @@ def changeit():
243
243
244
244
try :
245
245
np .place (result , mask , other )
246
- except :
246
+ except Exception :
247
247
return changeit ()
248
248
249
249
return result , False
@@ -274,14 +274,14 @@ def maybe_promote(dtype, fill_value=np.nan):
274
274
if issubclass (dtype .type , np .datetime64 ):
275
275
try :
276
276
fill_value = tslib .Timestamp (fill_value ).value
277
- except :
277
+ except Exception :
278
278
# the proper thing to do here would probably be to upcast
279
279
# to object (but numpy 1.6.1 doesn't do this properly)
280
280
fill_value = iNaT
281
281
elif issubclass (dtype .type , np .timedelta64 ):
282
282
try :
283
283
fill_value = lib .Timedelta (fill_value ).value
284
- except :
284
+ except Exception :
285
285
# as for datetimes, cannot upcast to object
286
286
fill_value = iNaT
287
287
else :
@@ -592,12 +592,12 @@ def maybe_convert_scalar(values):
592
592
593
593
def coerce_indexer_dtype (indexer , categories ):
594
594
""" coerce the indexer input array to the smallest dtype possible """
595
- l = len (categories )
596
- if l < _int8_max :
595
+ length = len (categories )
596
+ if length < _int8_max :
597
597
return _ensure_int8 (indexer )
598
- elif l < _int16_max :
598
+ elif length < _int16_max :
599
599
return _ensure_int16 (indexer )
600
- elif l < _int32_max :
600
+ elif length < _int32_max :
601
601
return _ensure_int32 (indexer )
602
602
return _ensure_int64 (indexer )
603
603
@@ -629,7 +629,7 @@ def conv(r, dtype):
629
629
r = float (r )
630
630
elif dtype .kind == 'i' :
631
631
r = int (r )
632
- except :
632
+ except Exception :
633
633
pass
634
634
635
635
return r
@@ -756,7 +756,7 @@ def maybe_convert_objects(values, convert_dates=True, convert_numeric=True,
756
756
if not isna (new_values ).all ():
757
757
values = new_values
758
758
759
- except :
759
+ except Exception :
760
760
pass
761
761
else :
762
762
# soft-conversion
@@ -817,7 +817,7 @@ def soft_convert_objects(values, datetime=True, numeric=True, timedelta=True,
817
817
# If all NaNs, then do not-alter
818
818
values = converted if not isna (converted ).all () else values
819
819
values = values .copy () if copy else values
820
- except :
820
+ except Exception :
821
821
pass
822
822
823
823
return values
@@ -888,10 +888,10 @@ def try_datetime(v):
888
888
try :
889
889
from pandas import to_datetime
890
890
return to_datetime (v )
891
- except :
891
+ except Exception :
892
892
pass
893
893
894
- except :
894
+ except Exception :
895
895
pass
896
896
897
897
return v .reshape (shape )
@@ -903,7 +903,7 @@ def try_timedelta(v):
903
903
from pandas import to_timedelta
904
904
try :
905
905
return to_timedelta (v )._values .reshape (shape )
906
- except :
906
+ except Exception :
907
907
return v .reshape (shape )
908
908
909
909
inferred_type = lib .infer_datetimelike_array (_ensure_object (v ))
0 commit comments