Python
#1

Calculate Frequency of Items in Python (Dictionary & Counter)

EasyAmazon
Interview Question #1
Asked at Amazon

Given a list of customer search query tags, write a Python function that returns a dictionary mapping each unique tag to its count frequency. Do not use external third-party libraries.

Input Table: tags list
1 rows preview
input_list
laptop,mouse,laptop,keyboard,mouse,laptop
Expected Output Structure3 rows
tagcount
laptop3
mouse2
keyboard1
Interview Context

Asked frequently in data analyst and business analyst technical rounds. Focus on clean filtering, optimal indexing usage, and unambiguous column selection.

Python 3.10 (Pandas)
Environment Ready

Click "Run & Test" to execute your Pandas code against the test assertions.

Chat with us