Skip to main content

sort-dataframeby-monthorweek

It sorts a dataframe by month names or by week names

Assume a dataframe has a month name column and one wants to sort the dataframe by month column in chronological order, this package helps to do that. This package can also be used to sort dataframe by weekday column.

How to install

pip install sort-dataframeby-monthorweek

There is another dependency package needs to be installed.

    pip install sorted-months-weekdays

There are 4 different functions in this package. We will see usage of below mentioned functions.

    Sort_Dataframeby_Month
    Sort_Dataframeby_Weekday

Example1

In this example we will see how to sort a sample dataframe by month name column

    import pandas as pd
	import itertools
    
    df = pd.DataFrame([['Feb',254],['Apr',420],['Jan',301],['Mar',449]],columns=['Month','Sales'])
    df
    Out: 
      Month  Sales
    0   Feb    254
    1   Apr    420
    2   Jan    301
    3   Mar    449

Now, use Sort_Dataframeby_Month function to sort above dataframe

    df_sort = sort_dataframeby_monthorweek.Sort_Dataframeby_Month(df=df,monthcolumnname='Month')
    df_sort
    Out:
      Month  Sales
    0   Jan    301
    1   Feb    254
    2   Mar    449
    3   Apr    420

Example2

In this example we will see how to sort a sample dataframe by weekday column

    df1 = pd.DataFrame([['Tue',25],['Thu',42],['Mon',30],['Wed',44]],columns=['Weekday','Sales'])
    df1
    Out: 
      Weekday  Sales
    0     Tue     25
    1     Thu     42
    2     Mon     30
    3     Wed     44

Now, use Sort_Dataframeby_Weekday function to sort df1

    df1_sort = sort_dataframeby_monthorweek.Sort_Dataframeby_Weekday(df=df1,Weekdaycolumnname='Weekday')
    df1_sort
    Out: 
      Weekday  Sales
    0     Mon     30
    1     Tue     25
    2     Wed     44
    3     Thu     42

Above functions work for lower, upper and mixed case months or weekdays. It works for full names of months ('January') and weekdays ('Monday') as well.

Metadata

Release files for sort-dataframeby-monthorweek 0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sort-dataframeby-monthorweek 0.4
File Size Uploaded Provenance
sort_dataframeby_monthorweek-0.4.tar.gz 2.8 kB Without provenance Details

Release files / sort_dataframeby_monthorweek-0.4.tar.gz

Download URL sort_dataframeby_monthorweek-0.4.tar.gz
Size 2.8 kB
Tags Source
SHA-256 checksum
How to use checksums
8f8f8a8313d45cab82c16483f9ef2236d394eaa43de39b068dd18ef80b7cdbb6
BLAKE2b-256 checksum
How to use checksums
7a10f5005db1735c3917c39bb29b2196aecee60d78a63663a107b8ac91c14c69
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/40.7.3 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.1

Security for sort-dataframeby-monthorweek 0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page