1
2
3
4
5
6
7
8
9
10
11
12
13
14
| #2. 创建一张空表
schema = pa.schema([pa.field("vector", pa.list_(pa.float32(), list_size=2))])
tbl = db.create_table("empty_table", schema=schema)
# 直接添加数据
data = [
{"vector": [1.3, 1.4], "item": "fizz", "price": 100.0},
{"vector": [9.5, 56.2], "item": "buzz", "price": 200.0},
]
tbl.add(data)
# 添加df数据帧
df = pd.DataFrame(data)
tbl.add(data)
|