Pass list as rowname_col
parameter
#512
Unanswered
abdullahau
asked this question in
Q&A
Replies: 1 comment 1 reply
-
@abdullahau , thanks for bringing up this discussion. Personally, I believe it’s possible to make some modifications to import polars as pl
from great_tables import GT
df = pl.DataFrame({"foo": [1, 2, 3], "bar": [3, 2, 1], "ham": [7, 8, 9]})
corr_matrix = df.corr().with_columns(pl.Series(df.columns).alias("index"))
(GT(corr_matrix, rowname_col="index")) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I was trying to create the correlation matrix from a Polars dataframe. Unlike Pandas, the .corr() method does not create an index where the column names appear on each row of the matrix. Is there a way to pass lists instead of column references for rowname? I could see this being really helpful while using Polars
Here is my workaround:
If you have suggestions for improvement, please let me know.
Beta Was this translation helpful? Give feedback.
All reactions