👻 Check our latest review to choose the best laptop for Machine Learning engineers and Deep learning tasks!
Let’s use a real dataset from TRAI to analyze mobile data rates and try to see the average speeds for a particular operator or state this month. It will also show how easily Pandas can be used on any real data to produce interesting results.
About the dataset —
Telecommunications Regulatory Authority of India (TRAI ) releases a monthly dataset of internet speeds measured by it via the app MySpeed ‚Äã‚Äã(TRAI) . This includes userinitiated speed tests or periodic background tests performed by the application. We will try to analyze this dataset and see the average speeds for a specific operator or state this month.
Checking the raw data structure:
 Go to TRAI MySpeed ‚Äã‚ÄãPortal and upload the last month’s CSV file in the Download section. You can also download the CSV file used in this article: sept18_publish.csv or sept18_publish_drive.csv
 Open this spreadsheet file.
NOTE . Since the dataset is huge, the software may warn you that it cannot load all the rows. It is perfectly. Also, if you are using Microsoft Excel, there may be a warning about opening the SYLK file. This error can be ignored as it is a common error in Excel.
Now let’s look at the location of the data1st column is of the Network Operator  JIO, Airtel etc.
2nd column is of the Network Technology  3G or 4G .
3rd column is the Type of Test initiated  upload or download .
4th column is the Speed ‚Äã‚ÄãMeasured in Kilobytes per second.
5th column is the Signal Strength during the measurement.
6th column is the Local Service Area (LSA) , or the circle where the test was done  Delhi, Orissa etc. We will refer to this as simply ’states’.
NOTE. Signal strength can be na (Not Available)
due to the fact that some devices cannot intercept the signal. We will ignore the use of this parameter in our calculations to simplify the process. However, this can easily be added as a condition when filtering.
Packages required 
Pandas  a popular data analysis toolkit. Very powerful for crunching large sets of data.
Numpy  provides fast and efficient operations on arrays of homogeneous data. We will use this to along with pandas and matplotlib.
Matplotlib  is a plotting library. We will use its bar plotting function to make bar graphs.
Let’s start analyzing the data.
Step # 1: Import packages and define some constants.

Step # 2: Define multiple lists that will store the final computed results so they can be easily passed to function of building a histogram. The state (or operator), download speed, and download speed will be stored sequentially, so the index, state (or operator) and their corresponding download and upload speeds can be accessed.
For example, final_states [2 ], final_download_speeds [2]
and final_upload_speeds [2]
will give the corresponding values ‚Äã‚Äãfor the 3rd state.
# define lists
final_download_speeds
=
[]
final_upload_speeds
=
[]
final_states
=
[]
final_operators
=
[]
Step # 3: Import the file using read_csv ()
Pandas read_csv ()
and save it to & # 39; df & # 39 ;. This will create a DataFrame of CSV content that we will work on.

Step # 4: First, let’s find all the unique states and statements in this dataset and store them in their respective lists of states and statements.
# find and display unique states
states
=
df [
’ State’
]. unique ()
print
(
’ STATES Found: ’
, states)
# find and display unique operators
operators
=
df [
’Service Provider’
]. unique ()
print
(
’OPERATORS Found:’
, operators)
Exit:
STATES Found: [’Kerala’’ Rajasthan’ ’Maharashtra’’ UP East’’ Karnataka’ nan ’Madhya Pradesh’’ Kolkata’’ Bihar’’ Gujarat’’ UP West, Orissa, Tamil Nadu, Delhi, Assam, Andhra Pradesh, Haryana, Punjab, North East, Mumbai, Chennai, Himachal Pradesh, Jammu & amp; Kashmir’’ West Bengal’] OPERATORS Found: [’IDEA’’ JIO’ ’AIRTEL’’ VODAFONE’’ CELLONE’]
Step # 5: Define the fixed_operator
function, which will keep the statement constant and iterate over all the available states for that statement. We can build a similar function for a fixed state.

Exit :
Kerala  Avg. Download: 26129.27 Avg. Upload: 5193.46 Rajasthan  Avg. Download: 27784.86 Avg. Upload: 5736.18 Maharashtra  Avg. Download: 20707.88 Avg. Upload: 4130.46 UP East  Avg. Download: 22451.35 Avg. Upload: 5727.95 Karnataka  Avg. Download: 16950.36 Avg. Upload: 4720.68 Madhya Pradesh  Avg. Download: 23594.85 Avg. Upload: 4802.89 Kolkata  Avg. Download: 26747.80 Avg. Upload: 5655.55 Bihar  Avg. Download: 31730.54 Avg. Upload: 6599.45 Gujarat  Avg. Download: 16377.43 Avg. Upload: 3642.89 UP West  Avg. Download: 23720.82 Avg. Upload: 5280.46 Orissa  Avg. Download: 31502.05 Avg. Upload: 6895.46 Tamil Nadu  Avg. Download: 16689.28 Avg. Upload: 4107.44 Delhi  Avg. Download: 20308.30 Avg. Upload: 4877.40 Assam  Avg. Download: 5653.49 Avg. Upload: 2864.47 Andhra Pradesh  Avg. Download: 32444.07 Avg. Upload: 5755.95 Haryana  Avg. Download: 7170.63 Avg. Upload: 2680.02 Punjab  Avg. Download: 14454.45 Avg. Upload: 4981.15 North East  Avg. Download: 6702.29 Avg. Upload: 2966.84 Mumbai  Avg. Download: 14070.97 Avg. Upload: 4118.21 Chennai  Avg. Download: 20054.47 Avg. Upload: 4602.35 Himachal Pradesh  Avg. Download: 7436.99 Avg. Upload: 4020.09 Jammu & amp; Kashmir  Avg. Download: 8759.20 Avg. Upload: 4418.21 West Bengal  Avg. Download: 16821.17 Avg. Upload: 3628.78
Plotting the data —
Use the arange ()
method of Numpy, which returns evenly spaced values ‚Äã‚Äãover a given interval. Here, passing the length of the list final_states
, we get values ‚Äã‚Äãfrom 0 to the number of states in the list, for example [0, 1, 2, 3 ...]
Then we can use these indices to build a bar in this place. The second bar is constructed by offsetting the location of the first bar by the width of the bar.

Comparing data from two months —
Let’s also take data from another month and plot it together to see the difference in data rates.
In this example, the dataset from the previous month will be the same as sept18_publish.csv, and next month’s dataset — oct18_publish.csv .
We just need to follow the same steps again. Read the data for another month. Filter it on subsequent data frames and then plot it using a slightly different method. During the construction of the columns, we will grow the 3rd and 4th columns (corresponding to the upload and download of the second file) by 2 and 3 times the width of the columns so that they are in their correct positions.
Below is the implementation for comparison data for 2 months:
👻 Read also: what is the best laptop for engineering students? Analyzing Mobile Data Rate from TRAI with Pandas __del__: QuestionsHow can I make a time delay in Python? 5 answers I would like to know how to put a time delay in a Python script. 2973
Answer #1
Here is another example where something is run approximately once a minute:
2973
Answer #2 You can use the
Analyzing Mobile Data Rate from TRAI with Pandas __del__: QuestionsHow to delete a file or folder in Python? 5 answers How do I delete a file or folder in Python? 2639
Answer #1
We hope this article has helped you to resolve the problem. Apart from Analyzing Mobile Data Rate from TRAI with Pandas, check other __del__related topics. Want to excel in Python? See our review of the best Python online courses 2022. If you are interested in Data Science, check also how to learn programming in R. By the way, this material is also available in other languages:
Manuel Danburry
Warsaw  20221208 Simply put and clear. Thank you for sharing. Analyzing Mobile Data Rate from TRAI with Pandas and other issues with find was always my weak point 😁. Will use it in my bachelor thesis Cornwall Porretti
Paris  20221208 Maybe there are another answers? What Analyzing Mobile Data Rate from TRAI with Pandas exactly means?. Will get back tomorrow with feedback Xu Chamberlet
Singapore  20221208 Maybe there are another answers? What Analyzing Mobile Data Rate from TRAI with Pandas exactly means?. Checked yesterday, it works! ShopLatest questions Wiki 