This repository contains a Python script call.py
that analyzes call logs stored in a text file. The script utilizes the pandas library to read and process the call logs data.
To run this script, you need to have the following:
-
Python 3.x
-
pandas library
-
Place the call logs text file (
call_logs.txt
) in the same directory as thecall.py
script. -
Open a terminal or command prompt and navigate to the directory containing
call.py
. -
Run the script using the following command:
python call.py
The script will read the call logs file, perform calculations, and display the results on the console.
The call.py
script performs the following actions:
-
Reads the call logs text file into a pandas DataFrame.
-
Removes leading spaces from column names in the DataFrame.
-
Sets the
CONTACT
variable to a specific value (to filter the DataFrame by a specific contact). -
Retrieves the
LOCAL
ID from the first row of the DataFrame. -
Filters the DataFrame to include only rows with the specified contact ID.
-
Calculates the total duration of calls with the specific contact (excluding missed calls).
-
Calculates the number of calls made to the specific contact (excluding missed calls).
-
Prints the date range of the call logs.
-
Prints the number of calls made to the specific contact (excluding missed calls).
-
Converts the total call duration from seconds to hours.
-
Prints the total duration of calls made to the specific contact in seconds and hours.
-
Calculates and prints the total duration in days, hours, minutes, and seconds.
Please note that you need to modify the CONTACT
variable in the script to specify the contact ID you want to analyze.
Feel free to explore the code and adapt it to your specific use case or modify it as needed.
This repository is licensed under the MIT License.