diff --git a/pandas/_libs/tslib.pyx b/pandas/_libs/tslib.pyx index 94e757624c136..53bcf5be2586a 100644 --- a/pandas/_libs/tslib.pyx +++ b/pandas/_libs/tslib.pyx @@ -114,7 +114,7 @@ def ints_to_pydatetime( const int64_t[:] arr, object tz=None, object freq=None, - bint fold=0, + bint fold=False, str box="datetime" ): """ @@ -288,7 +288,8 @@ def format_array_from_datetime( cdef: int64_t val, ns, N = len(values) ndarray[int64_t] consider_values - bint show_ms = 0, show_us = 0, show_ns = 0, basic_format = 0 + bint show_ms = False, show_us = False, show_ns = False + bint basic_format = False ndarray[object] result = np.empty(N, dtype=object) object ts, res npy_datetimestruct dts @@ -576,10 +577,10 @@ cpdef array_to_datetime( ndarray[object] oresult npy_datetimestruct dts bint utc_convert = bool(utc) - bint seen_integer = 0 - bint seen_string = 0 - bint seen_datetime = 0 - bint seen_datetime_offset = 0 + bint seen_integer = False + bint seen_string = False + bint seen_datetime = False + bint seen_datetime_offset = False bint is_raise = errors=='raise' bint is_ignore = errors=='ignore' bint is_coerce = errors=='coerce' @@ -606,7 +607,7 @@ cpdef array_to_datetime( iresult[i] = NPY_NAT elif PyDateTime_Check(val): - seen_datetime = 1 + seen_datetime = True if val.tzinfo is not None: if utc_convert: _ts = convert_datetime_to_tsobject(val, None) @@ -622,17 +623,17 @@ cpdef array_to_datetime( check_dts_bounds(&dts) elif PyDate_Check(val): - seen_datetime = 1 + seen_datetime = True iresult[i] = pydate_to_dt64(val, &dts) check_dts_bounds(&dts) elif is_datetime64_object(val): - seen_datetime = 1 + seen_datetime = True iresult[i] = get_datetime64_nanos(val) elif is_integer_object(val) or is_float_object(val): # these must be ns unit by-definition - seen_integer = 1 + seen_integer = True if val != val or val == NPY_NAT: iresult[i] = NPY_NAT @@ -651,7 +652,7 @@ cpdef array_to_datetime( elif isinstance(val, str): # string - seen_string = 1 + seen_string = True if len(val) == 0 or val in nat_strings: iresult[i] = NPY_NAT @@ -693,7 +694,7 @@ cpdef array_to_datetime( raise TypeError("invalid string coercion to datetime") if tz is not None: - seen_datetime_offset = 1 + seen_datetime_offset = True # dateutil timezone objects cannot be hashed, so # store the UTC offsets in seconds instead out_tzoffset_vals.add(tz.total_seconds()) @@ -709,7 +710,7 @@ cpdef array_to_datetime( # where we left off value = dtstruct_to_dt64(&dts) if out_local == 1: - seen_datetime_offset = 1 + seen_datetime_offset = True # Store the out_tzoffset in seconds # since we store the total_seconds of # dateutil.tz.tzoffset objects diff --git a/pandas/_libs/window/aggregations.pyx b/pandas/_libs/window/aggregations.pyx index a90d2f77e44d1..1d1963fb04818 100644 --- a/pandas/_libs/window/aggregations.pyx +++ b/pandas/_libs/window/aggregations.pyx @@ -846,7 +846,7 @@ def roll_median_c(ndarray[float64_t] values, ndarray[int64_t] start, ndarray[int64_t] end, int64_t minp, int64_t win): cdef: float64_t val, res, prev - bint err = 0 + bint err = False int ret = 0 skiplist_t *sl Py_ssize_t i, j diff --git a/pandas/_libs/writers.pyx b/pandas/_libs/writers.pyx index ebf98232da58b..091d76df26a17 100644 --- a/pandas/_libs/writers.pyx +++ b/pandas/_libs/writers.pyx @@ -82,7 +82,7 @@ def convert_json_to_lines(arr: object) -> str: """ cdef: Py_ssize_t i = 0, num_open_brackets_seen = 0, length - bint in_quotes = 0, is_escaping = 0 + bint in_quotes = False, is_escaping = False ndarray[uint8_t, ndim=1] narr unsigned char val, newline, comma, left_bracket, right_bracket, quote unsigned char backslash