Count frequency of values in a column in PIG?

ComputerFellow

I have something like this:

ColA ColB
a    xxx
b    yyy
c    xxx
d    yyy
e    xxx

I need to find out the number of times each value of ColB occurs.

Output:

xxx 3
yyy 2

Here's what I've been trying:

Considering A has my data,

grunt> B = GROUP A by ColB;
grunt> DESCRIBE B;
B: {group: chararray,A: {(ColA: chararray,ColB: chararray)}}

Now I'm confused, do I do something like this?

grunt> C = FOREACH B GENERATE COUNT(B.ColB)

So I need the output to be like this,

xxx 3
yyy 2
ComputerFellow

I figured it out.

C = FOREACH B GENERATE GROUP AS ColB, COUNT(A) as count;

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to plot frequency count of pandas column?

Count frequency of values in pandas DataFrame column

How to create a dataframe column from values with frequency count?

Frequency count of values in a column of a pandas DataFrame

Frequency of values per column in table

Sort by Frequency of Values in a Column - Pandas

How can I get a frequency count of values delimited by comma in a pandas dataframe column?

Count frequency of value in pandas column where values in another column are similar

Count freq of one column values in pandas dataframe and tag each row with its frequency occurence number

Count frequency of occurrence in column

Count frequency of values in pandas DataFrame

How to count the frequency of variable in pandas column

Count frequency of each word contained in column string values

How to count frequency of unique pair combinations from a column of comma-separated values?

How to get frequency count of column values for each unique pair of columns in pandas?

How to count each column values frequency combinations in R?

Count line values in Pig

How to count number frequency from specific column?

Count values that are filtered - Apache PIG

frequency count for file column in bash

How can I count the frequency of repeated values in dataframe column?

dividing column values in range and aggregate date by month to count frequency of range which fall in that month

how to count the frequency of digits exist in a column csv

Frequency count based on column values in Pandas

Replace the values in a column based on frequency

Count the frequency that a bunch of values occurs in a dataframe column

Count frequency of values in dictionary when values is a list

How to count frequency in one column based on unique values in another column in R?

Create new column with frequency of values