当前位置:   article > 正文

解决Pycharm打印结果折叠问题_pandas head print不折叠

pandas head print不折叠
from mlxtend.frequent_patterns import  apriori,association_rules
from mlxtend.preprocessing import  TransactionEncoder
import pandas as pd

#一次购物行为(事物)
dataset=[['Milk','Onion','Nutmeg','Kidney Beans','Eggs','Yogurt'],
         ['Dill','Onion','Nutmeg','Kidney Beans','Eggs','Yogurt'],
         ['Milk','Apple','Kidney Beans','Egg'],
         ['Milk','Unicorn','Corn','Kidney Beans','Yogurt'],
         ['Corn','Onion','Onion','Kidney Beans','Icy cream','Egg']]


transEn = TransactionEncoder()
oht_ary=transEn.fit(dataset).transform(dataset)

df=pd.DataFrame(oht_ary,columns=transEn.columns_)
print(df)
frequent_itemset=apriori(df,min_support=0.1,use_colnames=True)
print(frequent_itemset)
rules=association_rules(frequent_itemset,metric='lift',min_threshold=1.2)
print(rules.head(10))
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
结果如下

在这里插入图片描述

请加上这几句
pd.set_option('display.max_columns',None)
pd.set_option('display.max_rows',None)
  • 1
  • 2

在这里插入图片描述

声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop】
推荐阅读
相关标签
  

闽ICP备14008679号