oettam_oisolliv
oettam_oisolliv

Reputation: 226

Jupyter Notebook still truncating pandas columns

So, I have a pandas data frame with two fields

partition account_list
1 [id1,id2,id3,...]
2 [id4,id6,id5,...]

since the list is quite long and I want to see the complete content I'm using

pd.set_option('display.max_rows', None)
pd.set_option('display.max_columns', None)
pd.set_option('display.width', None)
pd.set_option('display.max_colwidth', -1)

louvain_communities.limit(tot_communities).toPandas()

nevertheless, as you can see (Jupiter I think) still truncate the column (I had to edit out the data for privacy)

enter image description here

Is there a way to fix this? I really need to check have the complete list, not truncated, to be shown.

Upvotes: 2

Views: 3012

Answers (1)

Rob Raymond
Rob Raymond

Reputation: 31166

max_colwidth and max_seq_items together work. Code below synthesises list with 500 items. Change the range() and you can test however many you want.

import pandas as pd
pd.set_option("max_colwidth", None)
pd.set_option("max_seq_items", None)
pd.DataFrame([{"partition":i, "account_list":[f"id{j}" for j in range(500)]} for i in range(2)])

Upvotes: 3

Related Questions