diff --git a/pandas/_libs/tslibs/parsing.pyx b/pandas/_libs/tslibs/parsing.pyx index ebdf7a1e29216..51202eea60a25 100644 --- a/pandas/_libs/tslibs/parsing.pyx +++ b/pandas/_libs/tslibs/parsing.pyx @@ -577,8 +577,8 @@ def try_parse_date_and_time(object[:] dates, object[:] times, object[:] result n = len(dates) - # Cast to avoid build warning see GH#26757 - if len(times) != n: + # TODO(cython 3.0): Use len instead of `shape[0]` + if times.shape[0] != n: raise ValueError('Length of dates and times must be equal') result = np.empty(n, dtype='O') @@ -614,8 +614,8 @@ def try_parse_year_month_day(object[:] years, object[:] months, object[:] result n = len(years) - # Cast to avoid build warning see GH#26757 - if len(months) != n or len(days) != n: + # TODO(cython 3.0): Use len instead of `shape[0]` + if months.shape[0] != n or days.shape[0] != n: raise ValueError('Length of years/months/days must all be equal') result = np.empty(n, dtype='O') @@ -640,10 +640,14 @@ def try_parse_datetime_components(object[:] years, double micros n = len(years) - # Cast to avoid build warning see GH#26757 - if (len(months) != n or len(days) != n or - len(hours) != n or len(minutes) != n or - len(seconds) != n): + # TODO(cython 3.0): Use len instead of `shape[0]` + if ( + months.shape[0] != n + or days.shape[0] != n + or hours.shape[0] != n + or minutes.shape[0] != n + or seconds.shape[0] != n + ): raise ValueError('Length of all datetime components must be equal') result = np.empty(n, dtype='O')