File tree Expand file tree Collapse file tree 3 files changed +13
-13
lines changed
Expand file tree Collapse file tree 3 files changed +13
-13
lines changed Original file line number Diff line number Diff line change @@ -423,7 +423,7 @@ def cons_row(x):
423423 result .name = name
424424 return result
425425
426- def _get_series_list (self , others ):
426+ def _get_series_list (self , others ) -> list [ Series ] :
427427 """
428428 Auxiliary function for :meth:`str.cat`. Turn potentially mixed input
429429 into a list of Series (elements without an index must match the length
@@ -474,8 +474,8 @@ def _get_series_list(self, others):
474474 for x in others
475475 ):
476476 los : list [Series ] = []
477- while others : # iterate through list and append each element
478- los = los + self ._get_series_list (others . pop ( 0 ))
477+ for other in others :
478+ los . extend ( self ._get_series_list (other ))
479479 return los
480480 # ... or just strings
481481 elif all (not is_list_like (x ) for x in others ):
Original file line number Diff line number Diff line change 11# being a bit too dynamic
22from __future__ import annotations
33
4- from math import ceil
4+ from math import (
5+ ceil ,
6+ floor ,
7+ log2 ,
8+ )
59from typing import TYPE_CHECKING
610import warnings
711
@@ -126,9 +130,7 @@ def _get_layout(
126130 try :
127131 return layouts [nplots ]
128132 except KeyError :
129- k = 1
130- while k ** 2 < nplots :
131- k += 1
133+ k = floor (log2 (nplots ))
132134
133135 if (k - 1 ) * k >= nplots :
134136 return k , (k - 1 )
Original file line number Diff line number Diff line change @@ -116,9 +116,8 @@ def next_workday(dt: datetime) -> datetime:
116116 returns next workday used for observances
117117 """
118118 dt += timedelta (days = 1 )
119- while dt .weekday () > 4 :
120- # Mon-Fri are 0-4
121- dt += timedelta (days = 1 )
119+ # Mon-Fri are 0-4
120+ dt += timedelta (days = max (dt .weekday () - 4 , 0 ))
122121 return dt
123122
124123
@@ -127,9 +126,8 @@ def previous_workday(dt: datetime) -> datetime:
127126 returns previous workday used for observances
128127 """
129128 dt -= timedelta (days = 1 )
130- while dt .weekday () > 4 :
131- # Mon-Fri are 0-4
132- dt -= timedelta (days = 1 )
129+ # Mon-Fri are 0-4
130+ dt -= timedelta (days = max (dt .weekday () - 4 , 0 ))
133131 return dt
134132
135133
You can’t perform that action at this time.
0 commit comments