Frequently used python methods/libraries.
Project description
Custom Python Library
Custom library for frequent used methods/libraries.
Installation : pip install RR-Custom-Python-Tools
License: GPLv3+
DateManager
Usage
To use the DateManager class, you need to import it and create an instance:
from date_manager.date_manager import DateManager
date_manager = DateManager()
timestamp_to_date(dataframe: pd.DataFrame) -> pd.DataFrame
Converts datetime columns in a DataFrame to date type.
Arguments:
dataframe (pd.DataFrame): The DataFrame containing the datetime columns. Returns:
pd.DataFrame: The input DataFrame with the datetime columns converted to date type. Example:
python Copy code import pandas as pd
Create a sample DataFrame
data = {'datetime_column': ['2022-01-01', '2022-01-02', '2022-01-03']} df = pd.DataFrame(data) df['datetime_column'] = pd.to_datetime(df['datetime_column'])
Convert datetime columns to date
converted_df = date_manager.timestamp_to_date(df) timestamp_to_date_column(column: str, dataframe: pd.DataFrame) -> pd.DataFrame Converts a specific datetime column in a DataFrame to date type.
Arguments:
column (str): The name of the datetime column to convert. dataframe (pd.DataFrame): The DataFrame containing the datetime column. Returns:
pd.DataFrame: The input DataFrame with the specified datetime column converted to date type. Raises:
ValueError: If the input DataFrame does not contain the specified datetime column. Example:
python Copy code import pandas as pd
Create a sample DataFrame
data = {'datetime_column': ['2022-01-01', '2022-01-02', '2022-01-03']} df = pd.DataFrame(data) df['datetime_column'] = pd.to_datetime(df['datetime_column'])
Convert specific datetime column to date
converted_df = date_manager.timestamp_to_date_column('datetime_column', df) Logging The DateManager class utilizes a logging mechanism provided by log_manager for capturing important events during the conversion process. Ensure you have the appropriate logger configuration to capture and manage log messages effectively.
Dependencies pandas: A powerful data manipulation library in Python used extensively for data analysis and manipulation. Author This module is maintained by [Your Name].
Feel free to contribute or report issues through GitHub [link to your GitHub repository].
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for RR-Custom-Python-Tools-0.0.8.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6d5463dbd7aaf42a116fd1a7fa0397f3d41b32ece99d818cf531afffa3f4a502 |
|
MD5 | 670d215fb6b25a70b40deadb4c3d6b1d |
|
BLAKE2b-256 | 7243959e648f6cbbca5bea9da4d3e04c43606df06ee376e977c5331a2c45f041 |
Hashes for RR_Custom_Python_Tools-0.0.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a37e89bf7e441cd454483ad9bd67d706217b4d1fee3c9a3e5ac5303a1f59d49f |
|
MD5 | 6107700c96af656cf7962237e0a0e201 |
|
BLAKE2b-256 | b43bca0745a5a98a37a258f7ded2a37e0894439ebb86a82b723b9ee5b054e53a |