Conversation
When calling Frame.fillMissingWith with an integer fill value (e.g. 0), missing float values were not filled because ColumnApply<int> tried to convert the float column to int (which is not a safe conversion) and skipped the column entirely. Fix: apply a two-pass strategy in fillMissingWith: 1. First pass (existing behavior): ColumnApply<'T> converts columns whose type can be safely widened to 'T. This preserves existing behaviour (e.g. decimal columns are converted to float when 'T = float). 2. Second pass (new): run transformColumn with VectorFillMissing.Constant on the result. In ArrayVector, when the boxed fill value does not type-match the vector's element type, attempt a safe numeric widening conversion of the fill value (e.g. int -> float). If not possible, the column is left unchanged. Includes regression test reproducing the scenario from issue #250. Co-authored-by: Copilot <[email protected]>
This was referenced Mar 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 This is an automated fix from Repo Assist.
Closes #250
Root cause
Frame.fillMissingWithwas implemented usingColumnApply<'T>, which attempts to cast each column to the fill value's type'Tusing a safe conversion. When filling with an integer0('T = int) but the frame containsfloatcolumns, the safe castfloat → intfails (it would be lossy), so the column was silently skipped — leaving missing values unfilled.Fix
A two-pass strategy is applied inside
fillMissingWith:First pass (existing behaviour):
ColumnApply<'T>converts columns whose element type can be safely widened to'T. For example,decimalcolumns are converted tofloatwhen'T = float, preserving the previously-tested behaviour.Second pass (new):
VectorHelpers.transformColumnwithVectorFillMissing.Constant (box value)is applied to the result. InArrayVector, when the boxed fill value's type does not match the vector element type'T, the code now attempts a safe numeric widening of the fill value to'T(e.g.int 0→float 0.0). If the conversion is not safe (e.g. trying to fill astringcolumn with anint), the column is left unchanged.Changes
src/Deedle/FrameModule.fsfillMissingWith; updated XML docsrc/Deedle/Vectors/ArrayVector.fsVectorFillMissing.Constantwhen fill value type doesn't match vector type; try safe conversion, leave unchanged on failuretests/Deedle.Tests/Frame.fsTest Status
✅ Build succeeded (0 errors, 4 pre-existing warnings)
✅ All 589 tests passed (
dotnet test tests/Deedle.Tests/Deedle.Tests.fsproj -c Release)