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

Ensure empty last line isnt printed when writing TSV #559

Merged
merged 1 commit into from
Nov 7, 2024

Conversation

matentzn
Copy link
Collaborator

@matentzn matentzn commented Nov 6, 2024

when printing df.to_csv(sep=sep, index=False), a line break is added automatically;

print(x) is also adding a line break, so when the dataframe string is printed, two line breaks are printed, leading to an empty line.

I also refactored the lines part a bit moving it inside the conditional, as they are only needed there.

when printing df.to_csv(sep=sep, index=False), a line break is added automatically;

print(x) is also adding a line break, so when the dataframe string is printed, two line breaks are printed, leading to an empty line.

I also refactored the `lines` part a bit moving it inside the conditional, as they are only needed there.
Copy link
Contributor

@anitacaron anitacaron left a comment

Choose a reason for hiding this comment

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

LGTM

@matentzn matentzn merged commit 4cad7d6 into master Nov 7, 2024
8 checks passed
@matentzn matentzn deleted the strip-empty-last-line branch November 7, 2024 17:34
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.

2 participants