<jupyter_start><jupyter_text><jupyter_code>#Importing panda and numpy libraries

import pandas as pd
import numpy as np

#loading the excel file on python by first assigning it to a variable
cells_geo_description = 'cells_geo_description.xlsx'

df = pd.read_excel(cells_geo_description, sheet_name=0, header=1)

#viewing the table
df

#loading the second excel file on python by first assigning it to a variable
CDR_description = 'CDR_description.xlsx'

df = pd.read_excel(CDR_description, sheet_name=0, header=1)

#viewing the table
df
#Loading the first csv file on to python
Telcom_dataset = 'Telcom_dataset.csv'

df = pd.read_csv(Telcom_dataset)
 
#Converting the DATE_TIME column to data type datetime
df['DATETIME']= pd.to_datetime(df['DATETIME']) 

#viewing the table
df.head(20)
#Loading the second csv file on to python
Telcom_dataset2 = 'Telcom_dataset2.csv'

df = pd.read_csv(Telcom_dataset2)

#Converting the DATE_TIME column to data type datetime
df['DATE_TIME']= pd.to_datetime(df['DATE_TIME']) 

#viewing the table
df.head(10)
#Loading the third csv file on to python
Telcom_dataset3 = 'Telcom_dataset3.csv'

df = pd.read_csv(Telcom_dataset3)

#Converting the DATE_TIME column to data type datetime
df['DATE_TIME']= pd.to_datetime(df['DATE_TIME']) 

#viewing the table
df.head(20)
#Loading the fourth csv file on to python
import csv
cells_geo = 'cells_geo.csv'

df_cells = pd.read_csv(cells_geo, delimiter = ';')

df_cells.rename(columns={'SITE_CODE' : 'SITE_ID'}, inplace=True)

#viewing the table
df_cells
#Determining which of the services offered by MTN is used the most in average
Telcom_dataset = 'Telcom_dataset.csv'

df = pd.read_csv(Telcom_dataset)

#Converting the DATE_TIME column to data type datetime
df['DATETIME']= pd.to_datetime(df['DATETIME']) 

mean_value = df['VALUE'].groupby(df['PRODUTC'])

mean_value.mean()



#Merging the datasets by columns, 
Telcom_dataset = 'Telcom_dataset.csv'

df = pd.read_csv(Telcom_dataset)

df.rename(columns={'PRODUTC' : 'PRODUCT', 'DATETIME' : 'DATE_TIME'}, inplace=True)

Telcom_dataset2 = 'Telcom_dataset2.csv'

df2 = pd.read_csv(Telcom_dataset2)

df2.rename(columns={'DW_A_NUMBER' : 'DW_A_NUMBER_INT', 'DW_B_NUMBER' : 'DW_B_NUMBER_INT'}, inplace=True)

Telcom_dataset3 = 'Telcom_dataset3.csv'

df3 = pd.read_csv(Telcom_dataset3)

df3.rename(columns={'CELLID' : 'CELL_ID', 'SIET_ID' : 'SITE_ID'}, inplace=True)

df4=pd.concat([df, df2, df3], axis=0)
df4


#Converting the DATE_TIME column to data type datetime
df4['DATE_TIME']= pd.to_datetime(df['DATE_TIME']) 
df4
#Determining which of the services offered by MTN is used the most in average

mean_value = df4['VALUE'].groupby(df['PRODUCT'])

mean_value.mean()

df5 = pd.merge(df2, df_cells, on='SITE_ID')
df5.head(5)

df6 = df5.groupby(['VILLES', 'VALUE']).agg('count')
df6
#Counting the number of cities to determine the busy cities.
df6["VILLES"].value_counts()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11694101508916324, 'fraction_numerical': 0.01440329218106996, 'mean_word_length': 6.2925, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '377541', 'license': 'MIT', 'n_tokens_mistral': 1138, 'n_tokens_neox': 1078, 'n_words': 276, 'path': 'Moringa_Data_Science_Prep_W3_Independent_Project_2020_07_Pruno_Jumah_Python_Project1.ipynb', 'repo_name': 'prunojumah/IP_Week3', 'size': '2916'}