0% found this document useful (0 votes)
34 views4 pages

2g RF Utilization

The document discusses processing 2G network data to calculate key performance indicators. It imports data files, extracts and concatenates them, calculates metrics like traffic share and RF utilization at the cell and network level. The results are exported and compared against target values to identify compliance.

Uploaded by

Mustafa Alalimi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views4 pages

2g RF Utilization

The document discusses processing 2G network data to calculate key performance indicators. It imports data files, extracts and concatenates them, calculates metrics like traffic share and RF utilization at the cell and network level. The results are exported and compared against target values to identify compliance.

Uploaded by

Mustafa Alalimi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Import Libraries

import os
import zipfile
import numpy as np
import pandas as pd
from glob import glob

Set Working Path


folder_path = 'D:/DataSets/KPIs/2G_RF_Utilization'
os.chdir(folder_path)

Import Erlang B Table


df = pd.read_html('https://github.com/Umersaeed81/KPI_Data_Set_For_Python_Scripts/blob/
df=df[0]
df=df.iloc[:,1:].\
astype({'No of Trunks (N)':'str'}).\
rename(columns={"with 2% Blocking":"Offer Traffic"})

Unzip Files
for file in os.listdir(folder_path): # get the list of files
if zipfile.is_zipfile(file): # if it is a zipfile, extract it
with zipfile.ZipFile(file) as item: # treat the file as a zip
item.extractall() # extract it in the working directory

List the Files in the Path


da_files = sorted(glob('*.csv'))
da_files

['GoS_Cell_Hourly_27062021(Cell Hourly).csv',
'GoS_Cell_Hourly_28062021(Cell Hourly).csv',
'GoS_Cell_Hourly_29062021(Cell Hourly).csv']

Concat All the csv Files


# concat all the Cluster DA Files
cluster_da=pd.concat((pd.read_csv(file,skiprows=[0,1,2,3,4],\
skipfooter=1,engine='python',\
parse_dates=["Date"],\
na_values=['NIL','/0']) for file in da_files),\
ignore_index=False).sort_values('Date').fillna(0)
Delete csv File from the Path
for filename in os.listdir(folder_path):
if filename.endswith('.csv'):
os.unlink(os.path.join(folder_path, filename))

Calculate FR and HR Traffic Share


cluster_da['FR_Share(%)'] = (cluster_da['U_EFR TRAFFIC']/cluster_da['GlobelTraffic'])*1
cluster_da['HR_Share(%)'] = (cluster_da['U_AMR HR TRAFFIC']/cluster_da['GlobelTraffic']

Convert K3015 Counter from float to integer


cluster_da['No of Trunks (N)'] = cluster_da['K3015:Available TCHs']\
.apply(np.floor)\
.astype(int)\
.astype(str)

Calculate Offer Traffic Per Cell/Hour


df0 = pd.merge(cluster_da,df,on=['No of Trunks (N)'])

Calculate 2G RF Utilization Cell Hourly)


df0['2G RF Utilization'] = df0['GlobelTraffic'].\
div(df0['Offer Traffic'])*100

Calculate 2G RF Utilization Cell Busy Hour)


df_cell_bh=df0.loc[df0.groupby(['Date','GBSC','Cell CI'])\
['GlobelTraffic'].idxmax()]

Sum Network Level Traffic and Offer Traffic


df1 = df0.groupby(['Date','Time'])\
[['GlobelTraffic','Offer Traffic']].\
sum().reset_index()

Calculation 2G RF Utilization(Network Level Hourly)


df1['2G RF Utilization'] = df1['GlobelTraffic'].\
div(df1['Offer Traffic'])*100
Calculation 2G RF Utilization(Network Level Busy Hour)
df_n_bh=df1.loc[df1.groupby(['Date'])\
['GlobelTraffic'].idxmax()]

Export Final Data Set


df0.to_csv('2G_Cell_Hourly_RF_Utilization.csv',index=False)

df_cell_bh.to_csv('2G_Cell_Busy_Hourly_RF_Utilization.csv',index=False)
df1.to_csv('2G_Network_Hourly_RF_Utilization.csv',index=False)
df_n_bh.to_csv('2G_Network_BH_RF_Utilization.csv',index=False)

SLA Target Values


df_sla=pd.DataFrame({
'KPI':['GOS-SDCCH(%)','CallSetup TCH GOS(%)','Mobility TCH GOS(%)'],
'Target Value':[0.1,2,2]})

Re-shape Cell Busy Hour Data


# select required columns
df_cell_bhmr = df_cell_bh[['Date','GBSC','Cell CI',\
'GOS-SDCCH(%)','CallSetup TCH GOS(%)',\
'Mobility TCH GOS(%)']]
# re-shpare
df_cell_bhm=pd.melt(df_cell_bhmr,\
id_vars=['Date', 'GBSC', 'Cell CI'],\
var_name="KPI", value_name='KPI-Value')

# merge cell busy data and re-shape


df_cell_summary = pd.merge(df_cell_bhm,df_sla,on=['KPI'])

Compare KPIs with Target Values


df_cell_summary['comp']=df_cell_summary['KPI-Value'] >= df_cell_summary['Target Value']

Conditional Pivot table


kp3=df_cell_summary.loc[df_cell_summary['comp']==True]\
.pivot_table(index=['Date'],\
columns='KPI',values=['comp'],\
aggfunc='count')\
.fillna(0)\
.apply(np.int64)\
.reset_index()

kp3.to_excel('Summary.xlsx')

You might also like