Skip to content

How many decimal places for support in the result set of fpgrowth? #1097

Answered by shenxiangzhuang
hpconnox asked this question in Q&A
Discussion options

You must be logged in to vote

TLDR

You can set the display.precision by pd.set_option("display.precision", 8) before you print the DataFrame and you will get what you need.

The details

There is no round operation in source code:

def generate_itemsets(generator, num_itemsets, colname_map):
itemsets = []
supports = []
for sup, iset in generator:
itemsets.append(frozenset(iset))
supports.append(sup / num_itemsets)
res_df = pd.DataFrame({"support": supports, "itemsets": itemsets})
if colname_map is not None:
res_df["itemsets"] = res_df["itemsets"].apply(
lambda x: frozenset([colname_map[i

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by hpconnox
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants