我正在使用google colab pyton 3.x,并且具有以下数据框。我想在每一行和每一列上看到整个单元格。我该怎么办?我试过了pd.set_option('display.max_columns', 3000)
但是没有
# importing pandas as pd
import pandas as pd
# dictionary of lists
dict = {'name':["a1", "b2", "c2", "d3"],
'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"],
'score':[90, 40, 80, 98]}
# creating a dataframe from a dictionary
df = pd.DataFrame(dict)
print (df)
name degree score
0 a1 We explained to customer how correct fees (100... 90
1 b2 customer was late in paying fees and we have t... 40
2 c2 customer's credit score was too low and we hav... 80
3 d3 customer complained a lot and didnt listen to ... 98
使用pd.set_option('max_colwidth', <width>)
对列宽和pd.set_option('max_rows', <rows>)
为行数。
参见https://pandas.pydata.org/pandas-docs/stable/user_guide/options.html
[] pd.set_option('max_rows', 99999)
[] pd.set_option('max_colwidth', 400)
[] pd.describe_option('max_colwidth')
display.max_colwidth : int
The maximum width in characters of a column in the repr of
a pandas data structure. When the column overflows, a "..."
placeholder is embedded in the output.
[default: 50] [currently: 400]
[] df = pd.DataFrame(d)
[] df
name degree score
0 a1 We explained to customer how correct fees (100) were charged. Account balance was too low 90
1 b2 customer was late in paying fees and we have to charge fine 40
2 c2 customer's credit score was too low and we have to charge higher interest rate 80
3 d3 customer complained a lot and didnt listen to our explanation. I had to escalate the call 98
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句