@@ -136,7 +136,7 @@ def trans(x): # noqa
136136 try :
137137 if np .allclose (new_result , result , rtol = 0 ):
138138 return new_result
139- except :
139+ except Exception :
140140
141141 # comparison of an object dtype with a number type could
142142 # hit here
@@ -151,14 +151,14 @@ def trans(x): # noqa
151151 elif dtype .kind in ['M' , 'm' ] and result .dtype .kind in ['i' , 'f' ]:
152152 try :
153153 result = result .astype (dtype )
154- except :
154+ except Exception :
155155 if dtype .tz :
156156 # convert to datetime and change timezone
157157 from pandas import to_datetime
158158 result = to_datetime (result ).tz_localize ('utc' )
159159 result = result .tz_convert (dtype .tz )
160160
161- except :
161+ except Exception :
162162 pass
163163
164164 return result
@@ -210,7 +210,7 @@ def changeit():
210210 new_result [mask ] = om_at
211211 result [:] = new_result
212212 return result , False
213- except :
213+ except Exception :
214214 pass
215215
216216 # we are forced to change the dtype of the result as the input
@@ -243,7 +243,7 @@ def changeit():
243243
244244 try :
245245 np .place (result , mask , other )
246- except :
246+ except Exception :
247247 return changeit ()
248248
249249 return result , False
@@ -274,14 +274,14 @@ def maybe_promote(dtype, fill_value=np.nan):
274274 if issubclass (dtype .type , np .datetime64 ):
275275 try :
276276 fill_value = tslib .Timestamp (fill_value ).value
277- except :
277+ except Exception :
278278 # the proper thing to do here would probably be to upcast
279279 # to object (but numpy 1.6.1 doesn't do this properly)
280280 fill_value = iNaT
281281 elif issubclass (dtype .type , np .timedelta64 ):
282282 try :
283283 fill_value = lib .Timedelta (fill_value ).value
284- except :
284+ except Exception :
285285 # as for datetimes, cannot upcast to object
286286 fill_value = iNaT
287287 else :
@@ -592,12 +592,12 @@ def maybe_convert_scalar(values):
592592
593593def coerce_indexer_dtype (indexer , categories ):
594594 """ 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 :
597597 return _ensure_int8 (indexer )
598- elif l < _int16_max :
598+ elif length < _int16_max :
599599 return _ensure_int16 (indexer )
600- elif l < _int32_max :
600+ elif length < _int32_max :
601601 return _ensure_int32 (indexer )
602602 return _ensure_int64 (indexer )
603603
@@ -629,7 +629,7 @@ def conv(r, dtype):
629629 r = float (r )
630630 elif dtype .kind == 'i' :
631631 r = int (r )
632- except :
632+ except Exception :
633633 pass
634634
635635 return r
@@ -756,7 +756,7 @@ def maybe_convert_objects(values, convert_dates=True, convert_numeric=True,
756756 if not isna (new_values ).all ():
757757 values = new_values
758758
759- except :
759+ except Exception :
760760 pass
761761 else :
762762 # soft-conversion
@@ -817,7 +817,7 @@ def soft_convert_objects(values, datetime=True, numeric=True, timedelta=True,
817817 # If all NaNs, then do not-alter
818818 values = converted if not isna (converted ).all () else values
819819 values = values .copy () if copy else values
820- except :
820+ except Exception :
821821 pass
822822
823823 return values
@@ -888,10 +888,10 @@ def try_datetime(v):
888888 try :
889889 from pandas import to_datetime
890890 return to_datetime (v )
891- except :
891+ except Exception :
892892 pass
893893
894- except :
894+ except Exception :
895895 pass
896896
897897 return v .reshape (shape )
@@ -903,7 +903,7 @@ def try_timedelta(v):
903903 from pandas import to_timedelta
904904 try :
905905 return to_timedelta (v )._values .reshape (shape )
906- except :
906+ except Exception :
907907 return v .reshape (shape )
908908
909909 inferred_type = lib .infer_datetimelike_array (_ensure_object (v ))
0 commit comments