This package provides various functions for data analysis, statistical calculations, database operations, and sending notifications.
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
This function provides statistical summary of a given dataframe.
df
(pandas.DataFrame): The input dataframe
- A dataframe containing various statistics for each column
- 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
import pandas as pd
import datanerd as dn
df = pd.read_csv('titanic.csv')
summary_stats = dn.stats(df)
This function calculates the Weight of Evidence (WoE) and Information Value (IV) for a given dataframe.
data
(pandas.DataFrame): The input dataframetarget
(str): The name of the target variablebins
(int): The number of bins to use for discretizing continuous variablesoptimize
(bool): Whether to optimize the binning of continuous variablesthreshold
(float): The minimum percentage of non-events in each bin for optimization
- A tuple containing two dataframes: (iv, woe)
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)
This function pushes a Pandas dataframe to a Microsoft SQL Server database.
data
(pandas.DataFrame): The dataframe to be pushedtablename
(str): The name of the table in the databaseserver
(str): The name of the SQL Serverdatabase
(str): The name of the databaseschema
(str): The name of the schema
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')
This function sends a formatted message to a Microsoft Teams channel using a webhook URL.
webhook_url
(str): The webhook URL for the Teams channeltitle
(str): The title of the messagemessage
(str): The body of the message
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)
This function sends a notification message to an ntfy.sh server.
server
(str): The name of the ntfy.sh server/topic to send the message tomessage
(str): The message to be sent
import datanerd as dn
server = "your_server_name"
message = "This is a test notification from Python!"
dn.ntfy(server, message)