Skip to content

Pandas

1
2
# Install the opendal and pandas
!pip install opendal, pandas
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
import pandas as pd

import opendal

# Init an operator.
op = opendal.Operator("fs", root="/tmp")

# Create and write a csv file
op.write("test.csv", b"name,age\nAlice,25\nBob,30\nCharlie,35")

# Open and read the DataFrame from the file.
with op.open("test.csv", mode="rb") as file:
    read_df = pd.read_csv(file)
    print(f"read_df: {read_df}")