Performing count values on multiple columns with a loop or batch count

Hello everyone,

I just started using KNIME and getting stuck in what seems some pretty basic stuff.

Here is my python code :

for col in df_cmd.columns:
print(df_cmd[col].value_counts(ascending=True, dropna=True))
print(df_cmd[col].value_counts(ascending=True, normalize=True, dropna=True)*100)

Which basically gives me the count and percent for each category for each variable in my data frame.

Trying to replicate that in KNIME, i can have the count of one colum with the value count and getting crazy trying to get that through the groupBy node.

I simply want the count per category for all the variables (columns).

So is there a way to loop through all the columns and run the value count, then push that into a new table or something ?

Thank you !

So replying to myself after try and errors. Quite basically just using the statistics node, the numbers are in the third output. Just filtered out and send to file.


Hi @WamaW - welcome to the forum, and thanks for posting your solution!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.