-
Notifications
You must be signed in to change notification settings - Fork 478
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 docs: Add an example for opendal + pandas/polars #4270
Comments
Maybe we can integrate with polars directly? |
Seems that we could open a file and then pass the reader to pandas/polars? |
Yep, it should just work. |
This is my first time in the opendal community 😄 Well, I just saw this issue, and I'm glad you mentioned polars also(I am one of the core dev of polars).
I'm not familiar with opendal, but I tried to run the following code: op = opendal.Operator("fs", root="xxx")
pandas.read_csv(open("xxx/a.csv", mode="rb")) # this works
polars.read_csv(open("xxx/a.csv", mode="rb")) # this works
with op.open("a.csv", mode ="rb") as file:
pandas.read_csv(file) # this raise
with op.open("a.csv", mode ="rb") as file:
polars.read_csv(file) # this raise If the file is opened via opendal, both |
Thanks for coming!
It seems to be a bug. We expect them to work the same way. Let me look into this. |
Thank you for your quick reply! BTW, the cat a.csv
a,b
1,2
3,4 |
@Xuanwo Oops, the difference between the file-like object crated via For the For example: with open("./a.csv", mode="rb") as file:
file.read(10000000) # this works
with op.open("a.csv", mode="rb") as file:
file.read(10000000) # this raise: `OSError: ContentIncomplete (permanent) at , context: { expect: 10000000, actual: 5 } => reader got too little data` polars & pandas will call the |
Thank you so much for the research! And you are right, I must impelment this in wrong:
Do you have interest to give it a fix? |
Another question is: Is it make sense to have |
Our read API used to accept |
Great! With these two changes, I can now have polars and pandas create DataFrame from opendal locally. |
This example will help users to use opendal in pandas/polars.
We can add a new ipynb like we do in https://github.com/apache/opendal/blob/main/bindings/python/examples/object.ipynb
The text was updated successfully, but these errors were encountered: