Skip to content

Empty csv fix #835

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 23, 2024
Merged

Empty csv fix #835

merged 3 commits into from
Aug 23, 2024

Conversation

Jolanrensen
Copy link
Collaborator

Fixes #834

See test for expected behavior

@Jolanrensen Jolanrensen requested a review from koperagen August 23, 2024 09:45
file = File.createTempFile("empty", "csv"),
header = listOf("a", "b", "c"),
)
emptyCsvFileManualHeader shouldBe dataFrameOf("a", "b", "c").fill(0) { "" }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why zeros?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, wait, it's not zeros but 0 rows of empty strings?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

emptyCsvFileManualHeader["a"].type() shouldBe typeOf<String>()
emptyCsvFileManualHeader["a"].isEmpty() shouldBe true 

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, this generates a DF with 3 named empty String columns

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could also write something like dataFrameOf("a", "b", "c") { emptyList<String>() } or plenty of other variants :) not sure which is the clearest

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'd prefer checks like above, because it takes time to imagine result of df constructor rather than see expected assertions

@koperagen
Copy link
Collaborator

Please make a rebase and squash fixup before merge

Copy link
Contributor

Generated sources will be updated after merging this PR.
Please inspect the changes in here.

@koperagen
Copy link
Collaborator

Thank you! Don't forget the milestone and other things

@Jolanrensen
Copy link
Collaborator Author

Thank you! Don't forget the milestone and other things

they are already on the issue, as @zaleslaw recommended :)

@Jolanrensen Jolanrensen merged commit 569ef70 into master Aug 23, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reading empty CSV bug
2 participants