I am using Google Colab python 3.x and I have a Dataframe as below. I would like to see all cells on each row and column. How can I do this? I tried pd.set_option('display.max_columns', 3000)
but it didn’t work.
JavaScript
x
19
19
1
# importing pandas as pd
2
import pandas as pd
3
4
# dictionary of lists
5
dict = {'name':["a1", "b2", "c2", "d3"],
6
'degree': ["We explained to customer how correct fees (100) were charged. Account balance was too low", "customer was late in paying fees and we have to charge fine", "customer's credit score was too low and we have to charge higher interest rate", "customer complained a lot and didnt listen to our explanation. I had to escalate the call"],
7
'score':[90, 40, 80, 98]}
8
9
# creating a dataframe from a dictionary
10
df = pd.DataFrame(dict)
11
print (df)
12
13
14
name degree score
15
0 a1 We explained to customer how correct fees (100... 90
16
1 b2 customer was late in paying fees and we have t 40
17
2 c2 customer's credit score was too low and we hav... 80
18
3 d3 customer complained a lot and didnt listen to 98
19
Advertisement
Answer
use pd.set_option('max_colwidth', <width>)
for column width & pd.set_option('max_rows', <rows>)
for number of rows.
see https://pandas.pydata.org/pandas-docs/stable/user_guide/options.html
JavaScript
1
19
19
1
[] pd.set_option('max_rows', 99999)
2
[] pd.set_option('max_colwidth', 400)
3
[] pd.describe_option('max_colwidth')
4
5
display.max_colwidth : int
6
The maximum width in characters of a column in the repr of
7
a pandas data structure. When the column overflows, a "..."
8
placeholder is embedded in the output.
9
[default: 50] [currently: 400]
10
11
[] df = pd.DataFrame(d)
12
[] df
13
14
name degree score
15
0 a1 We explained to customer how correct fees (100) were charged. Account balance was too low 90
16
1 b2 customer was late in paying fees and we have to charge fine 40
17
2 c2 customer's credit score was too low and we have to charge higher interest rate 80
18
3 d3 customer complained a lot and didnt listen to our explanation. I had to escalate the call 98
19