Build a sampleM for the monadic interface by wrapping DataFRame.Opera…#137
Merged
mchav merged 2 commits intoDataHaskell:mainfrom Jan 23, 2026
Merged
Build a sampleM for the monadic interface by wrapping DataFRame.Opera…#137mchav merged 2 commits intoDataHaskell:mainfrom
mchav merged 2 commits intoDataHaskell:mainfrom
Conversation
…tions.Subset.sample in DataFrame.Monad.modifyM, like filterWhereM
Member
|
Thanks so much @amiri! Agreed we should have tests. I'm trying to figure out how to get good property tests working but this feels like it's a fine change to visually inspect. You can run the following commands to eyeball the results: $ ./scripts/repl.sh
ghci> :script dataframe.ghci
dataframe> df <- D.readCsv "./data/housing.csv"
dataframe> D.nRows df
-- some number
dataframe> import DataFrame.Monad
dataframe> import System.Random
dataframe> D.nRows (execFrame df (sampleM (mkStdGen 431) 0.1))
-- Should be 10% of previous number. |
Contributor
Author
|
OK, that worked, but I used |
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.
…tions.Subset.sample in DataFrame.Monad.modifyM, like filterWhereM
I think I did this correctly. I feel uncomfortable with the lack of tests, though, and I don't know how to test this code. I would appreciate any guidance on how to do that here. I could then write tests for the other monadic functions, too.