emacs cannot display polars dataframes

104 Views Asked by At

When I try to print a DataFrame in emacs (python & elpy enviroment), I get the following error message:

UnicodeEncodeError: 'charmap' codec can't encode characters in position 15-27: character maps to <undefined>

Here is a minimal example where the error occurs:

import polars as pl

df = pl.DataFrame({
    "A": [1, 2, 3],
    "B": [3, 2, 1],
})

print(df)

It is probably a simple encoding problem, however I have no approach how to solve it. In my init.el I have already made the following entry, but this does not lead to the desired success.

  (prefer-coding-system 'utf-8)
  (set-default-coding-systems 'utf-8)
  (set-language-environment 'utf-8)
  (set-selection-coding-system 'utf-8)

The same code, running in cmd results in a clean loocking tabel like this

┌─────┬─────┐
│ A   ┆ B   │
│ --- ┆ --- │
│ i64 ┆ i64 │
╞═════╪═════╡
│ 1   ┆ 3   │
│ 2   ┆ 2   │
│ 3   ┆ 1   │
└─────┴─────┘
0

There are 0 best solutions below