Analysing Mobile Data Speeds from TRAI with Pandas in Python



The Telecom Regulatory Authority of India (TRAI) publishes the data regarding mobile internet speeds for various telecom operations across India. It is useful for users and telecom companies to evaluate and compare the performance of different service providers.

In this article, we are going to use pandas in Python to analyze the TRAI mobile data speed reports. Let's assume we have downloaded the CSV file named demo.csv with the following structure to use in the examples.

demo.csv file
date operator circle download_Speed upload_Speed
2025-06-01 Airtel Hyderabad 23.4 8.5
2025-06-01 Idea Vijayawada 22.5 8.0
2025-06-01 Jio Mumbai 10.6 6.0
2025-06-01 BSNL Kerala 7.4 3.0

You can load a dataset using the read_csv() function. It reads data from the CSV (Comma-Separated Values) file and converts it into a dataframe.

import pandas as pd
x=pd.read_csv("demo.csv")
print(x.head())

The output of the above program is as follows -

D:\>python test.py
  date\toperator\tcircle\tdownload_Speed \tupload_Speed
0           01-06-2025\tAirtel\tHyderabad\t23.4\t8.5
1              01-06-2025\tIdea\tVijayawada\t22.5\t8
2                   01-06-2025\tJio\tMumbai\t10.6\t6
3                   01-06-2025\tBSNL\tKerala\t7.4\t3

Using Boolean Indexing

Boolean indexing is the technique used in Python, particularly within libraries like NumPy and Pandas, for filtering and selecting data based on a specific condition. It is also known as Boolean masking.

Example

Consider the following example, where we are going to filter data for a specific circle.

import pandas as pd
x = pd.read_csv("demo.csv", sep='\t')
x.columns = x.columns.str.strip()
x['circle'] = x['circle'].astype(str).str.strip().str.lower()
y = x[x['circle'] == 'hyderabad']
print(y)

The output of the above program is as follows -

date         operator     circle          download_Speed  upload_Speed
2025-06-01   Airtel       hyderabad           23.4            8.5

Using groupby() Method

The Pandas groupby() method is used to split a DataFrame into groups based on one or more columns, allowing for efficient data analysis.

It follows the "split-apply-combine" strategy, where the data is divided into groups, then the function is applied to each group, and the result is combined into a new DataFrame.

Example

In the following example, we are going to find out the top 3 circles with the average download speed.

import pandas as pd
x = pd.read_csv("demo.csv", delim_whitespace=True)
x.columns = x.columns.str.strip()
x['download_Speed'] = pd.to_numeric(x['download_Speed'], errors='coerce')
z=x.groupby('circle')['download_Speed'].mean().sort_values(ascending=False).head(3)
print(z)

Following is the output of the above program -

circle
Hyderabad     23.4
Vijayawada    22.5
Mumbai        10.6

Conclusion

With the help of pandas, analysing the mobile data speed from TRAI becomes easy. From filtering operator-specific data to ranking performance by region, we can get a clear analysis using just a few lines of code.

Updated on: 2025-07-14T15:23:33+05:30

193 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements