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

why is_file_like needs to see __iter__ #17591

Closed
stonefly opened this issue Sep 19, 2017 · 3 comments
Closed

why is_file_like needs to see __iter__ #17591

stonefly opened this issue Sep 19, 2017 · 3 comments
Labels
Duplicate Report Duplicate issue or pull request IO CSV read_csv, to_csv

Comments

@stonefly
Copy link

stonefly commented Sep 19, 2017

I have a question regarding the new is_file_like function and its usage in IO functions like read_csv

This new change in pandas 0.20 breaks many codes which previously assume that a file-like object is just an object possessing read or write method.

Is there any specific reason we have to enforce such conditions?

When making such changes why we have to break the previous behaviors?

@jorisvandenbossche
Copy link
Member

@stonefly There are a couple of related issues about this, eg see #17135, #16135, #16530
Can you see if you have additional issues that are not mentioned there?

If so, please be more specific: what files are giving trouble? What version of pandas are you using? (some things were fixed only in 0.20.2)

@gfyoung gfyoung added the IO CSV read_csv, to_csv label Sep 19, 2017
@stonefly
Copy link
Author

stonefly commented Sep 19, 2017

Hi, I can confirm that 0.20.2 fixes our problem (because it does not see next method in 0.20.1).

But in general it is not the first time we got surprising breaks due to some changes like this.

Do you know why we start changing this logic since 0.20?

Isn't duck-typing rule sufficient here?

@jreback
Copy link
Contributor

jreback commented Sep 20, 2017

closing as this is duplicated by many issues.

@jreback jreback closed this as completed Sep 20, 2017
@jreback jreback added the Duplicate Report Duplicate issue or pull request label Sep 20, 2017
@jreback jreback added this to the No action milestone Sep 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate Report Duplicate issue or pull request IO CSV read_csv, to_csv
Projects
None yet
Development

No branches or pull requests

4 participants