Skip to main content

The Telco Data Science Toolkit - sklearn-style library for telecommunications data analysis

Reason this release was yanked:

Test Version

Project description

PyTelco 🛰️

The Telco Data Science Toolkit - An sklearn-style Python library for telecommunications data analysis.

Python 3.8+ License: MIT


🎯 What is PyTelco?

PyTelco provides low-level building blocks for telecom data scientists to analyze CDR, SIP, and GTP-U data. Think of it as scikit-learn for telecommunications.

from pytelco import to_dense_timeseries, add_lags, add_rolling, fill_missing

# Convert sparse CDR events to dense time-series
dense_df = to_dense_timeseries(cdr_df, entity_cols=['imsi'], freq='1D', fill_value=0)

# Add temporal features
dense_df = add_lags(dense_df, cols=['uplink_bytes'], lags=[1, 7, 30], entity_col='imsi')
dense_df = add_rolling(dense_df, cols=['uplink_bytes'], windows=[7, 30], funcs=['mean', 'std'])

# Clean data
dense_df = fill_missing(dense_df, strategy='forward', entity_col='imsi')

📦 Installation

# From PyPI (when published)
pip install pytelco

# From GitHub
pip install git+https://github.com/girishgouda16/PyTelco.git

# Local development
git clone https://github.com/girishgouda16/PyTelco.git
cd PyTelco
pip install -e .

🧰 Core Functions

Preprocessing

Function Description
to_dense_timeseries() Convert sparse events to fixed-frequency grid
fill_missing() Handle NaN values (zero, forward, interpolate)
clip_outliers() Remove extreme values (percentile, IQR, zscore)
validate_schema() Validate input data before processing

Temporal Features

Function Description
add_lags() Add lagged features (t-1, t-7, etc.)
add_rolling() Add rolling statistics (mean, std, sum)
add_diff() Add differenced features
compute_slope() Compute trend direction
extract_sequences() Create sequences for LSTM/Transformer models

Domain Features

Function Description
compute_sip_metrics() SIP signaling quality metrics
compute_gtpu_metrics() GTP-U traffic analysis
compute_cdr_metrics() CDR billing and usage metrics

🚀 Quick Start

Example 1: CDR Churn Analysis

from pytelco import to_dense_timeseries, add_lags, add_rolling, compute_slope
from pytelco.io import load_cdr

# Load data
cdr_df = load_cdr("data/cdr/")

# Create dense time-series (THE KEY STEP)
dense_df = to_dense_timeseries(
    cdr_df,
    entity_cols=['imsi'],
    value_cols=['uplink_bytes', 'downlink_bytes'],
    freq='1D',
    fill_value=0
)

# Add features
dense_df = add_lags(dense_df, cols=['uplink_bytes'], lags=[1, 7, 30], entity_col='imsi')
dense_df = add_rolling(dense_df, cols=['uplink_bytes'], windows=[7, 30], funcs=['mean', 'std'])
dense_df = compute_slope(dense_df, col='uplink_bytes', window=7, entity_col='imsi')

# Ready for ML!
X = dense_df[['uplink_bytes', 'uplink_bytes_lag_1', 'uplink_bytes_rolling_7_mean']].values

Example 2: Sequence Extraction for Deep Learning

from pytelco import to_dense_timeseries, extract_sequences

# Create dense time-series
dense_df = to_dense_timeseries(df, entity_cols=['teid'], freq='5min')

# Extract sequences for LSTM
X = extract_sequences(
    dense_df,
    entity_col='teid',
    feature_cols=['throughput_bps', 'payload_entropy'],
    seq_length=48  # 4 hours of 5-min buckets
)

# X.shape = (n_sequences, 48, 2) - Ready for Keras/PyTorch!

📁 Package Structure

pytelco/
├── preprocessing/
│   ├── time_series.py    # to_dense_timeseries, align_to_grid
│   ├── cleaning.py       # fill_missing, clip_outliers
│   └── validation.py     # validate_schema
├── temporal/
│   ├── lags.py           # add_lags, add_rolling, add_diff
│   ├── sequences.py      # extract_sequences
│   └── trends.py         # compute_slope, compute_velocity
├── features/
│   ├── sip.py            # SIP signaling metrics
│   ├── gtpu.py           # GTP-U traffic metrics
│   └── cdr.py            # CDR billing metrics
└── io/
    └── loaders.py        # load_sip, load_gtpu, load_cdr

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.


📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytelco-0.2.1.tar.gz (19.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytelco-0.2.1-py3-none-any.whl (23.9 kB view details)

Uploaded Python 3

File details

Details for the file pytelco-0.2.1.tar.gz.

File metadata

  • Download URL: pytelco-0.2.1.tar.gz
  • Upload date:
  • Size: 19.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.0

File hashes

Hashes for pytelco-0.2.1.tar.gz
Algorithm Hash digest
SHA256 a82e7126f692cd36434f9212e91e6cff5c51d3bde7d40182742063088c629c38
MD5 d54c2aeff7b46e84935e111c05776ab3
BLAKE2b-256 c5a4ed4b245772a316e0696f971c8544282e2757a4c03f1401d9fbb38eb755d1

See more details on using hashes here.

File details

Details for the file pytelco-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: pytelco-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 23.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.0

File hashes

Hashes for pytelco-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 889588fd4f733a9451302a4b92d219d2fe7f1c14f0b2644cfb579c52d01a65ab
MD5 5baffed8a3eea470a52c80381d4d118d
BLAKE2b-256 c169383718be8e6ab95f0c759eaf898104794643a8c2f89715a0c5aa145fafc2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page