-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
fix: read_csv
for empty lines
#11924
Conversation
read_csv
for empty filesread_csv
for empty lines
crates/polars-io/src/csv/utils.rs
Outdated
@@ -350,14 +350,19 @@ pub fn infer_file_schema_inner( | |||
// keep track so that we can determine the amount of bytes read | |||
end_ptr = line.as_ptr() as usize + line.len(); | |||
|
|||
let len = line.len(); | |||
|
|||
if len == 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if line.is_empty()
py-polars/tests/unit/io/test_csv.py
Outdated
use_pyarrow=False, | ||
) | ||
expected = pl.DataFrame({"A": ["a", None, "b"]}) | ||
print(df) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove the print?
py-polars/tests/unit/io/test_csv.py
Outdated
use_pyarrow=False, | ||
) | ||
expected = pl.DataFrame({"A": ["a", "c"], "B": ["b", "d"]}) | ||
print(df) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove the print?
Thank you @uchiiii |
To fix #11611