假设我有以下数据框:
| 代码 | 价格 |
|---|---|
| AA1 | 10 |
| AA1 | 20 |
| BB2 | 30 |
我想对其执行以下操作:
df.groupby("code").aggregate({
"price": "sum"
})
Run Code Online (Sandbox Code Playgroud)
我尝试使用 Pandas 2.0 中引入的新 pyarrow dtypes,并创建了 3 个副本,对于每个副本,我测量了上述操作的执行时间(5 次执行的平均值)。
| 代码列数据类型 | 价格列数据类型 | 执行时间处理时间 |
|---|---|---|
| 目的 | 浮动64 | 2.94秒 |
| 字符串[pyarrow] | 双[pyarrow] | 49.5秒 |
| 字符串[pyarrow] | 浮动64 | 1.11秒 |
谁能解释为什么与标准 numpy float64 dtype 相比,在具有 double pyarrow dtype 的列上应用聚合函数如此慢?
我使用以下命令创建了一个符号链接:
php artisan storage:link
Run Code Online (Sandbox Code Playgroud)
然后我在storage/app/public. 按照文档,我可以通过以下方式获得此文件的链接:
asset('storage/file.txt')
Run Code Online (Sandbox Code Playgroud)
在 html 代码中返回:
http://127.0.0.1:8000/storage/psps.txt
Run Code Online (Sandbox Code Playgroud)
但我收到 404 错误。有什么帮助吗?