You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "reswqa (via GitHub)" <gi...@apache.org> on 2024/03/14 06:18:36 UTC

Re: [I] python docs: Add an example for opendal + pandas/polars [opendal]

reswqa commented on issue #4270:
URL: https://github.com/apache/opendal/issues/4270#issuecomment-1996603884

   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).
   
   > Seems that we could open a file and then pass the reader to pandas/polars?
   
   I'm not familiar with opendal, but I tried to run the following code:
   ```python
   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
   ```
   
   But both of `polars` and `pandas` raise `OSError: failed to fill whole buffer`. IIUC, `op.open("a.csv", mode ="rb")` is a file-like object that we expect to work directly. Feel free to point out if I missed something? Thanks!
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org