小编Jor*_*dan的帖子

有人同时使用过 Polars 和 Seaborn 或 Matplotlib 吗?

有人使用 Seaborn 的 Polars 数据框来绘制图表吗?我一直在 Kaggle 上使用 Pandas 编写笔记本,我想将其重构为 Polars。

我正在使用的数据框如下所示:

乘客 ID (i64) 幸存 (i64) P级 (i64) 名称(字符串) ... 门票(str) 票价 (f64) 客舱(str) 已登船 (str) 年龄 (f64)
1 0 3 你的名字在这里 ... A/5 21171 7.25 无效的 S 24
... ... ... ... ... ... ... ... ... ...

Kaggle 让我使用以下代码制作直方图:

g = sns.FacetGrid(train_df, col='Survived')
g.map(plt.hist, 'Age', bins=20)
Run Code Online (Sandbox Code Playgroud)

当我运行这两行时,出现以下错误:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/seaborn/axisgrid.py", line 678, in map
    for (row_i, col_j, hue_k), …
Run Code Online (Sandbox Code Playgroud)

python types seaborn python-polars

4
推荐指数
1
解决办法
2328
查看次数

标签 统计

python ×1

python-polars ×1

seaborn ×1

types ×1