You seem to want to group by several columns at once:
df.groupby(['revenue','session','user_id'])['user_id'].count()
should give you what you want
More Related Contents:
- How can I pivot a dataframe?
- How to group dataframe rows into list in pandas groupby
- Concatenate strings from several rows using Pandas groupby
- Groupby value counts on the dataframe pandas
- Split pandas dataframe based on groupby
- Pandas: filling missing values by mean in each group
- GroupBy pandas DataFrame and select most common value
- Converting a Pandas GroupBy output from Series to DataFrame
- pandas GroupBy columns with NaN (missing) values
- Count unique values per groups with Pandas [duplicate]
- Multiple aggregations of the same column using pandas GroupBy.agg()
- Pandas groupby cumulative sum
- Python Pandas max value in a group as a new column
- pandas dataframe groupby datetime month
- How to loop over grouped Pandas dataframe?
- How to move pandas data from index to column after multiple groupby
- Python – rolling functions for GroupBy object
- Pandas GroupBy and select rows with the minimum value in a specific column
- Use pandas.shift() within a group
- Pandas Groupby and Sum Only One Column
- Python Pandas Group by date using datetime data
- Python Pandas Conditional Sum with Groupby
- Identifying statistical outliers with pandas: groupby and reduce rows into different dataframe
- Pandas Groupby / List to Multiple Rows
- Sample each group after pandas groupby
- Pandas groupby with categories with redundant nan
- pandas groupby where you get the max of one column and the min of another column
- Bar graph from dataframe groupby
- pandas group by and assign a group id then ungroup
- What is the equivalent of SQL “GROUP BY HAVING” on Pandas?