Skip to content
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

Changed file opens to binary mode for to_csv calls. #521

Closed
wants to merge 102 commits into from

Conversation

ptth222
Copy link

@ptth222 ptth222 commented Jan 23, 2024

When writing dataframes using the to_csv method on Windows, blank rows are inserted after every row. There is a decent Stack Overflow post about the issue here: https://stackoverflow.com/questions/56398306/using-pandas-to-write-file-creates-blank-lines. The 2 best fixes are either to open the file in binary mode or don't open the file manually and just pass the filename to the method directly. I went through the package and found instances of "to_csv" usage and changed the opening style to "wb".

I initially only encountered this problem when writing study and assay files, so I know changing to "wb" fixes the issue there, but I did not test the other instances I found.

@terazus
Copy link
Collaborator

terazus commented Mar 1, 2024

We need a very small discussion on this matter since the functions changed were not open_csv but simple open() functions.

@ptth222
Copy link
Author

ptth222 commented Mar 1, 2024

@terazus Does "we" include me, or do you mean you guys?

@terazus
Copy link
Collaborator

terazus commented Mar 1, 2024

@ptth222 It means whoever wants to participate :) you are warmly welcome to discuss this with us.

@ptth222
Copy link
Author

ptth222 commented Mar 1, 2024

@terazus It can include me or not. I took "small discussion" to me like a voice communication meeting, so we would need to coordinate that if I needed to be in there.

terazus and others added 5 commits March 1, 2024 14:20
Fix to determining JSON directory location.
The last changes were initially tested and created on Windows, but had errors on GitHub. I fixed those errors, but didn't retest on Windows. This has been tested on both and is problem free.
Fixed parts of the code that needed to be changed to work with bytes. There are no more errors in testing.
@ptth222 ptth222 force-pushed the windows-to_csv-fix branch from 40579e1 to 0f7b791 Compare March 8, 2024 13:50
@terazus
Copy link
Collaborator

terazus commented Mar 11, 2024

Closing, dupe of #547

@terazus terazus closed this Mar 11, 2024
@ptth222 ptth222 deleted the windows-to_csv-fix branch March 20, 2024 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

3 participants