Skip to main content

Contains multiple functions stats(), iv_woe(), pushdb(), teams_webhook(), and ntfy()

Project description

DataNerd

This package provides various functions for data analysis, statistical calculations, database operations, and sending notifications.

Installation

To use these functions, you need to have Python installed on your system. You also need to install the required libraries. You can install them using pip:

pip install pandas numpy sqlalchemy requests

Functions

1. stats()

This function provides statistical summary of a given dataframe.

Parameters:

  • df (pandas.DataFrame): The input dataframe

Returns:

  • A dataframe containing various statistics for each column

Statistics provided:

  • count
  • mean
  • std
  • min
  • 10th, 20th, 25th, 30th, 40th, 50th (median), 60th, 70th, 75th, 80th, 90th, 95th, 99th percentiles
  • max
  • % of missing values
  • number of unique values

Usage:

import pandas as pd
import datanerd as dn

df = pd.read_csv('titanic.csv')
summary_stats = dn.stats(df)

2. iv_woe()

This function calculates the Weight of Evidence (WoE) and Information Value (IV) for a given dataframe.

Parameters:

  • data (pandas.DataFrame): The input dataframe
  • target (str): The name of the target variable
  • bins (int): The number of bins to use for discretizing continuous variables
  • optimize (bool): Whether to optimize the binning of continuous variables
  • threshold (float): The minimum percentage of non-events in each bin for optimization

Returns:

  • A tuple containing two dataframes: (iv, woe)

Usage:

import pandas as pd
import datanerd as dn

df = pd.read_csv('cancer.csv')
iv, woe = dn.iv_woe(data=df, target='Diagnosis', bins=20, optimize=True, threshold=0.05)

3. pushdb()

This function pushes a Pandas dataframe to a Microsoft SQL Server database.

Parameters:

  • data (pandas.DataFrame): The dataframe to be pushed
  • tablename (str): The name of the table in the database
  • server (str): The name of the SQL Server
  • database (str): The name of the database
  • schema (str): The name of the schema

Usage:

import pandas as pd
import datanerd as dn

df = pd.read_csv('day.csv')
dn.pushdb(df, tablename='day', server='SQL', database='schedule', schema='analysis')

4. teams_webhook()

This function sends a formatted message to a Microsoft Teams channel using a webhook URL.

Parameters:

  • webhook_url (str): The webhook URL for the Teams channel
  • title (str): The title of the message
  • message (str): The body of the message

Usage:

import datanerd as dn

webhook_url = "https://outlook.office.com/webhook/..."
title = "Important Notification"
message = "This is a test message sent from Python!"

dn.teams_webhook(webhook_url, title, message)

5. ntfy()

This function sends a notification message to an ntfy.sh server.

Parameters:

  • server (str): The name of the ntfy.sh server/topic to send the message to
  • message (str): The message to be sent

Usage:

import datanerd as dn

server = "your_server_name"
message = "This is a test notification from Python!"

dn.ntfy(server, message)

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

datanerd-1.2.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

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

datanerd-1.2-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file datanerd-1.2.tar.gz.

File metadata

  • Download URL: datanerd-1.2.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.8.18

File hashes

Hashes for datanerd-1.2.tar.gz
Algorithm Hash digest
SHA256 55e8543044255d7756cfe716d8b99b7402b9d5eada93607ee155a7248ce768ce
MD5 3937498b42965ff36a6abad9a0335605
BLAKE2b-256 bc759d128d0b8c0728004d995defe9fc8492135215e57c064a9feb0ec7d5e9c3

See more details on using hashes here.

File details

Details for the file datanerd-1.2-py3-none-any.whl.

File metadata

  • Download URL: datanerd-1.2-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.8.18

File hashes

Hashes for datanerd-1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 62eb0ec18d16823fca7c83e37e7b5291a3d2691e4b085a8fdbddfa0f5ee46c60
MD5 039e620410710c310011094a8da91cbf
BLAKE2b-256 5184ec0c366685b453261f5b3b3520ea69bca959e9981022f6c28d94aed4e1f4

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