A pandas extension that solves all problems of Jalai/Iraninan/Shamsi dates

Overview

HitCount PyPI - Downloads PyPI version Code style: black codecov License: GPL v3 Open In Colab GitHub Repo stars

Jalali Pandas Extentsion

A pandas extension that solves all problems of Jalai/Iraninan/Shamsi dates

Jalali Pandas python package

Features

Series Extenstion

  • Convert string to Jalali date 1388/03/25 --> jdatetime(1388,3,25,0,0)
  • Convert Georgian date to Jalali date datetime(2019,11,17,0,0) --> jdatetime(1398,8,26,0,0)
  • Convert Jalali date to Georgian date jdatetime(1398,10,18,0,0) --> datetim(2020,1,8,6,19)

DataFrame extenstion

  • Support grouping by Jalali date
  • Group by year, month, days, ...
  • Shortcuts for groups: ymd for ['year','month','day'] and more
  • Resampling: Convenience method for frequency conversion and resampling of time series but in Jalali dateformat. (comming soon)

Installation

pip install -U jalali-pandas

Usage

Just import jalali-pandas and use pandas just use .jalali as a method for series and dataframes. Nothin outside pandas.

jalali-pandas is an extentsion for pandas, that add a mehtod for series/columns and dataframes.

Series

import pandas as pd
import jalali_pandas

# create dataframe
df = pd.DataFrame({"date": pd.date_range("2019-01-01", periods=10, freq="D")})

# convert to jalali
df["jdate"] = df["date"].jalali.to_jalali()

# convert to gregorian
df["gdate"] = df["jdate"].jalali.to_georgian()

# parse string to jalali
df1 = pd.DataFrame({"date": ["1399/08/02", "1399/08/03", "1399/08/04"]})
df1["jdate"] = df1["date"].jalali.parse_jalali("%Y/%m/%d")


# get access to jalali year,quarter ,month, day and weekday
df['year'] = df["jdate"].jalali.year
df['month'] = df["jdate"].jalali.month
df['quarter'] = df["jdate"].jalali.quarter
df['day'] = df["jdate"].jalali.day
df['weekday'] = df["jdate"].jalali.weekday

DataFrame

import pandas as pd
import jalali_pandas

df = pd.DataFrame(
    {
    "date": pd.date_range("2019-01-01", periods=10, freq="M"),
    "value": range(10),
    }
)
# make sure to create a column with jalali datetime format. (you can use any name)
df["jdate"] = df["date"].jalali.to_jalali()


# group by jalali year
gp = df.jalali.groupby("year")
gp.sum()

#group by month
mean = df.jalali.groupby('mean')

#groupby year and month and day
mean = df.jalali.groupby('ymd')
# or
mean = df.jalali.groupby(['year','month','day'])


#groupby year and quarter
mean = df.jalali.groupby('yq')
# or
mean = df.jalali.groupby(['year','quarter'])

ToDos:

  • add Georgian to Jalali Conversion
  • add Jalali to Georgian Conversion
  • add support for sampling
  • add date parser from other columns
  • add date parser from string
You might also like...
Interactive plotting for Pandas using Vega-Lite
Interactive plotting for Pandas using Vega-Lite

pdvega: Vega-Lite plotting for Pandas Dataframes pdvega is a library that allows you to quickly create interactive Vega-Lite plots from Pandas datafra

Create HTML profiling reports from pandas DataFrame objects
Create HTML profiling reports from pandas DataFrame objects

Pandas Profiling Documentation | Slack | Stack Overflow Generates profile reports from a pandas DataFrame. The pandas df.describe() function is great

Productivity Tools for Plotly + Pandas
Productivity Tools for Plotly + Pandas

Cufflinks This library binds the power of plotly with the flexibility of pandas for easy plotting. This library is available on https://github.com/san

A high-level plotting API for pandas, dask, xarray, and networkx built on HoloViews
A high-level plotting API for pandas, dask, xarray, and networkx built on HoloViews

hvPlot A high-level plotting API for the PyData ecosystem built on HoloViews. Build Status Coverage Latest dev release Latest release Docs What is it?

A GUI for Pandas DataFrames
A GUI for Pandas DataFrames

PandasGUI A GUI for analyzing Pandas DataFrames. Demo Installation Install latest release from PyPi: pip install pandasgui Install directly from Githu

Bokeh Plotting Backend for Pandas and GeoPandas
Bokeh Plotting Backend for Pandas and GeoPandas

Pandas-Bokeh provides a Bokeh plotting backend for Pandas, GeoPandas and Pyspark DataFrames, similar to the already existing Visualization feature of

Joyplots in Python with matplotlib & pandas :chart_with_upwards_trend:
Joyplots in Python with matplotlib & pandas :chart_with_upwards_trend:

JoyPy JoyPy is a one-function Python package based on matplotlib + pandas with a single purpose: drawing joyplots (a.k.a. ridgeline plots). The code f

Interactive plotting for Pandas using Vega-Lite
Interactive plotting for Pandas using Vega-Lite

pdvega: Vega-Lite plotting for Pandas Dataframes pdvega is a library that allows you to quickly create interactive Vega-Lite plots from Pandas datafra

📊📈 Serves up Pandas dataframes via the Django REST Framework for use in client-side (i.e. d3.js) visualizations and offline analysis (e.g. Excel)

📊📈 Serves up Pandas dataframes via the Django REST Framework for use in client-side (i.e. d3.js) visualizations and offline analysis (e.g. Excel)

Comments
  • Sourcery refactored main branch

    Sourcery refactored main branch

    Branch main refactored by Sourcery.

    If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

    See our documentation here.

    Run Sourcery locally

    Reduce the feedback loop during development by using the Sourcery editor plugin:

    Review changes via command line

    To manually merge these changes, make sure you're on the main branch, then run:

    git fetch origin sourcery/main
    git merge --ff-only FETCH_HEAD
    git reset HEAD^
    

    Help us improve this pull request!

    opened by sourcery-ai[bot] 2
  • تبدیل تاریخ میلادی به شمسی

    تبدیل تاریخ میلادی به شمسی

    برای تبدیل تاریخ میلادی به شمسی (جلالی) اگر تاریخ به صورت یک اعداد هشت رقمی در ستون اعداد وارد شده باشد کتابخانه با اررور مواجه می شود برای مثال 20211202 تبدیل به 1400-09-11 یا 1400/09/11 یا 14000911 نمی شود

    opened by d4rk-n0153 1
Releases(v0.2.2)
Owner
Want to be a learner. LifeTime Learner
null
Some problems of SSLC ( High School ) before outputs and after outputs

Some problems of SSLC ( High School ) before outputs and after outputs 1] A Python program and its output (output1) while running the program is given

Fayas Noushad 3 Dec 1, 2021
Python code for solving 3D structural problems using the finite element method

3DFEM Python 3D finite element code This python code allows for solving 3D structural problems using the finite element method. New features will be a

Rémi Capillon 6 Sep 29, 2022
NumPy and Pandas interface to Big Data

Blaze translates a subset of modified NumPy and Pandas-like syntax to databases and other computing systems. Blaze allows Python users a familiar inte

Blaze 3.1k Jan 1, 2023
Sparkling Pandas

SparklingPandas SparklingPandas aims to make it easy to use the distributed computing power of PySpark to scale your data analysis with Pandas. Sparkl

null 366 Oct 27, 2022
Create HTML profiling reports from pandas DataFrame objects

Pandas Profiling Documentation | Slack | Stack Overflow Generates profile reports from a pandas DataFrame. The pandas df.describe() function is great

null 10k Jan 1, 2023
Productivity Tools for Plotly + Pandas

Cufflinks This library binds the power of plotly with the flexibility of pandas for easy plotting. This library is available on https://github.com/san

Jorge Santos 2.7k Dec 30, 2022
A high-level plotting API for pandas, dask, xarray, and networkx built on HoloViews

hvPlot A high-level plotting API for the PyData ecosystem built on HoloViews. Build Status Coverage Latest dev release Latest release Docs What is it?

HoloViz 697 Jan 6, 2023
A GUI for Pandas DataFrames

PandasGUI A GUI for analyzing Pandas DataFrames. Demo Installation Install latest release from PyPi: pip install pandasgui Install directly from Githu

Adam 2.8k Jan 3, 2023
Bokeh Plotting Backend for Pandas and GeoPandas

Pandas-Bokeh provides a Bokeh plotting backend for Pandas, GeoPandas and Pyspark DataFrames, similar to the already existing Visualization feature of

Patrik Hlobil 822 Jan 7, 2023
Joyplots in Python with matplotlib & pandas :chart_with_upwards_trend:

JoyPy JoyPy is a one-function Python package based on matplotlib + pandas with a single purpose: drawing joyplots (a.k.a. ridgeline plots). The code f

Leonardo Taccari 462 Jan 2, 2023