Skip to main content

Набор простых функций для работы с данными

Project description

otvertka

otvertka

Набор простых функций для работы с данными в ClickHouse.

Установка

pip install otvertka

Использование

from otvertka import fetch_data, generate_ab_test_data, get_dates_tuples, get_table_info, handle_outliers

# Получить информацию о таблице
get_table_info('my_table')

# Выполнить SQL запрос
df = fetch_data('SELECT * FROM my_table LIMIT 10')

# Разбить временной интервал на периоды
dates = get_dates_tuples('2024-01-01', '2024-02-01', days_interval=7)

# Сгенерировать тестовые данные для A/B теста
df = generate_ab_test_data(
    groups=['control', 'test'],
    num_observations_per_group=10000,
    effect_size=0.05,
    base_retention_prob=0.3,
    base_impressions_mean=5,
    base_revenue_scale=1.0
)

# Обработать выбросы в данных
df = handle_outliers(
    df,
    target_column='revenue',
    threshold_quantile=0.995,
    handling_method='replace_threshold',
    outlier_type='upper',
    grouping_column='group'
)

Требования

  • Python 3.7+
  • Необходимые переменные окружения:
    • CH_USER - пользователь ClickHouse
    • CH_PASSWORD - пароль ClickHouse
    • CH_HOST - хост ClickHouse (по умолчанию: localhost)
    • CH_PORT - порт ClickHouse (по умолчанию: 8123)

Лицензия

MIT

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

otvertka-0.1.11.tar.gz (480.9 kB view details)

Uploaded Source

Built Distribution

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

otvertka-0.1.11-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file otvertka-0.1.11.tar.gz.

File metadata

  • Download URL: otvertka-0.1.11.tar.gz
  • Upload date:
  • Size: 480.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.0

File hashes

Hashes for otvertka-0.1.11.tar.gz
Algorithm Hash digest
SHA256 25dc34e8da3ab4fa8594f437594d0b53fc7fd4741f540cd96a7a6330e24b8965
MD5 533b85d82a34332375cb470211349c6b
BLAKE2b-256 2315648fb4339f8d850413a6d9e17fc53ca4e14ed5044a6307c4b8c714a71957

See more details on using hashes here.

File details

Details for the file otvertka-0.1.11-py3-none-any.whl.

File metadata

  • Download URL: otvertka-0.1.11-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.0

File hashes

Hashes for otvertka-0.1.11-py3-none-any.whl
Algorithm Hash digest
SHA256 dfc6175a67163d14b3c6c94122b1cbe40ee163cbd905ed9ff2c9de8090065b2d
MD5 1e9615a8f668ceeb402e01e5c85561e3
BLAKE2b-256 4c0ee9069f4d7e75f8aad5d7dac778619fa89583dc96f8a8aeb85ba4b9af17b1

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