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

[Python] CSV ReadOptions column_names None defaults to an empty array #45020

Closed
alikleit opened this issue Dec 13, 2024 · 2 comments
Closed

[Python] CSV ReadOptions column_names None defaults to an empty array #45020

alikleit opened this issue Dec 13, 2024 · 2 comments

Comments

@alikleit
Copy link

Describe the bug, including details regarding any error messages, version, and platform.

When using the ReadOptions type, and setting None to column_names. ReadOptions is then setting it to [].

Changing the value afterwards results into an error:

read_options.column_names = None
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   TypeError: 'NoneType' object is not iterable

This means that it force us to define our columns manually, rather than it automatically discovering it from the head.

Any idea?

Component(s)

Python

@raulcd
Copy link
Member

raulcd commented Dec 13, 2024

Thanks for raising the issue! Is this about pyarrow.csv.ReadOptions? Are you using autogenerate_column_names?
Could you share a small snippet of your use case so it's easier for us to understand what is the use case you are looking for?
I basically don't understand what you mean by:

This means that it force us to define our columns manually, rather than it automatically discovering it from the head.

why is having an iterable [] instead of None forcing you to define columns manually?

@raulcd raulcd changed the title CSV ReadOptions column_names None defaults to an empty array [Python] CSV ReadOptions column_names None defaults to an empty array Dec 13, 2024
@alikleit
Copy link
Author

My bad!

skip_row=0 solved my problem! - had it on 1 by default. thought that skip_row is not related to the header and header would be discovered when setting it to 'None'.

Thanks for the quick response though appreciated!! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants