Skip to content

Commit

Permalink
Fix: Unnecessary accessor on scalar
Browse files Browse the repository at this point in the history
  • Loading branch information
simmsa committed Jan 31, 2025
1 parent 58953ca commit b735b96
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mhkit_python_utils/type_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ def convert_series(data: pd.Series) -> ConversionResult:

values = np.array(data.values)
series_name = data.name
this_type = get_numeric_type(values[0])

# Handle single value series
if values.size == 1:
Expand All @@ -186,13 +187,14 @@ def convert_series(data: pd.Series) -> ConversionResult:
if isinstance(values[0], (float, np.floating))
else int(values[0])
)
this_type = get_numeric_type(values)

# Always include index information
index_name = data.index.name if data.index.name is not None else "index"
index_data = convert_index(data.index)

return ConversionResult(
type=f"array_{get_numeric_type(values[0])}",
type=f"array_{this_type}",
data={series_name: values},
index={
"name": index_name,
Expand Down

0 comments on commit b735b96

Please sign in to comment.