Skip to content
Snippets Groups Projects
Commit 40160d20 authored by Riccardo Boero's avatar Riccardo Boero :innocent:
Browse files

Fixed Floating point reference in preprocessing of dataframes for SQL save

parent 470d24f7
No related branches found
No related tags found
No related merge requests found
......@@ -366,17 +366,16 @@ After preprocessing, `df` will have its `NaN` and `Inf` values replaced with `no
function preprocess_dataframe!(df::DataFrame)
for col in names(df)
col_type = eltype(df[!, col])
# Clamp values if range is defined for the column type
if haskey(SQL_RANGES, col_type)
min_val, max_val = SQL_RANGES[col_type]
df[!, col] = clamp.(df[!, col], min_val, max_val)
end
# Replace NaN and Inf with nothing
if col_type <: FloatingPoint
# Replace NaN and Inf with nothing for floating-point columns
if col_type <: AbstractFloat
df[!, col] = map(x -> isfinite(x) ? x : nothing, df[!, col])
end
end
end
end
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment