@@ -144,8 +144,7 @@ def _from_dataframe(df: DataFrameXchg, allow_copy: bool = True) -> pd.DataFrame:
144
144
else :
145
145
pandas_df = pd .concat (pandas_dfs , axis = 0 , ignore_index = True , copy = False )
146
146
147
- index_obj = df .metadata .get ("pandas.index" , None )
148
- if index_obj is not None :
147
+ if (index_obj := df .metadata .get ("pandas.index" , None )) is not None :
149
148
pandas_df .index = index_obj
150
149
151
150
return pandas_df
@@ -372,8 +371,7 @@ def string_column_to_ndarray(col: Column) -> tuple[np.ndarray, Any]:
372
371
def parse_datetime_format_str (format_str , data ) -> pd .Series | np .ndarray :
373
372
"""Parse datetime `format_str` to interpret the `data`."""
374
373
# timestamp 'ts{unit}:tz'
375
- timestamp_meta = re .match (r"ts([smun]):(.*)" , format_str )
376
- if timestamp_meta :
374
+ if timestamp_meta := re .match (r"ts([smun]):(.*)" , format_str ):
377
375
unit , tz = timestamp_meta .group (1 ), timestamp_meta .group (2 )
378
376
if unit != "s" :
379
377
# the format string describes only a first letter of the unit, so
@@ -386,8 +384,7 @@ def parse_datetime_format_str(format_str, data) -> pd.Series | np.ndarray:
386
384
return data
387
385
388
386
# date 'td{Days/Ms}'
389
- date_meta = re .match (r"td([Dm])" , format_str )
390
- if date_meta :
387
+ if date_meta := re .match (r"td([Dm])" , format_str ):
391
388
unit = date_meta .group (1 )
392
389
if unit == "D" :
393
390
# NumPy doesn't support DAY unit, so converting days to seconds
0 commit comments