@@ -482,14 +482,18 @@ def _parse_col_def_column_name(
482482 col_data = self ._apply_multiplier (table = table , column = col_name , data = col_data )
483483 return pd .DataFrame (col_data )
484484
485- try : # Maybe it is not a column name, but a float value like 'inf', let's try to convert the string to a float
486- const_value = float (col_def )
487- except ValueError :
488- # pylint: disable=raise-missing-from
489- columns_str = " and " .join (f"'{ col_name } '" for col_name in columns )
490- raise KeyError (f"Could not find column { columns_str } on table '{ table } '" )
491-
492- return self ._parse_col_def_const (data = data , table = table , col_def = const_value , table_mask = table_mask )
485+ def _get_float (value : str ) -> Optional [float ]:
486+ try :
487+ return float (value )
488+ except ValueError :
489+ return None
490+
491+ # Maybe it is not a column name, but a float value like 'inf', let's try to convert the string to a float
492+ if (const_value := _get_float (col_def )) is not None :
493+ return self ._parse_col_def_const (data = data , table = table , col_def = const_value , table_mask = table_mask )
494+
495+ columns_str = " and " .join (f"'{ col_name } '" for col_name in columns )
496+ raise KeyError (f"Could not find column { columns_str } on table '{ table } '" )
493497
494498 def _apply_multiplier (self , table : str , column : str , data : pd .Series ) -> pd .Series :
495499 if self ._multipliers is None :
0 commit comments