How to expand the output of a truncated list to view more values of Pandas dataframe

Viewed 26

Is there a specific way to display all the truncated data values of a list. The displayed values are as follows

         v                          w

Row1    [0.1, 0.2, 0.3 .....1.0] [0.1, 0.2, 0.3 .....1.0] 

Here are the option I tried Option 1 p

 pd.set_option('display.max_colwidth', None)
 pd.set_option('display.max_seq_items', None)
 z  = pd.read_csv('a.csv') 

Output: it is still truncated

Option 2

for i, row in z.iterrows():
    for j in row['w']:
        print(j) 

Output: it is stll truncated Any help on how to display all the truncated values and display the full list.

1 Answers

You can print after conversion to_string:

print(df.to_string())

output:

                                                            v                                                        w
Row1  [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]  [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]

Used input:

L = list(np.arange(0, 1.1, 0.1).round(2))
df = pd.DataFrame({'v': [L], 'w': [L]}, index=['Row1'])

default print:

                                                      v  \
Row1  [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, ...   

                                                      w  
Row1  [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, ...  
Related