Skip to main content

Powerful package to prettify DataFrame into table.

Project description

Logo

What is it ?

Pandaspretty is a python package which provides you feature to convert your DataFrame in a good looking table, just in few steps. It aims to make everything simple.

What's new ?

  • More customizable options
  • New methods to create

Main features

  1. Custom styles
  2. Attractive tables
  3. Fast
  4. Automatically resizable cells

Where to get it

The source code is currently available on github

Installation from sources

To install it using PIP use the following command

pip install Pandaspretty

Usage

here is an example :

Let's suppose you have a DataFrame named df having value

  Name Class Roll_no Section
0 Ayush kumar 12 8 A
1 Prince kumar 12 23 A
2 Khushi singh 12 18 B
3 Prathisha 12 23 B

Code to prettify your DataFrame (df)

import Pandaspretty as pp
[...]
prettyfied = pp.pretty(df)
print(prettyfied)

Output :

+----------------+---------+-----------+-----------+
|           Name |   Class |   Roll_no |   Section |
+----------------+---------+-----------+-----------+
|    Ayush kumar |      12 |         8 |         A |
+----------------+---------+-----------+-----------+
|   Prince kumar |      12 |        23 |         A |
+----------------+---------+-----------+-----------+
|   Khushi singh |      12 |        18 |         B |
+----------------+---------+-----------+-----------+
|      Prathisha |      12 |        23 |         B |
+----------------+---------+-----------+-----------+

More About it

Importing

import Pandaspretty as pp 

Methods :

  • pretty(data = df, corner='%', separator=';', joins='=')

  • to_sql(data, index = True)

  • tabulate(data,index = True ,corner = '+', separator='|', joins='-')

Parameters :

  • data : Accepts a dataframe object.

  • index : Set index True/False to see the index of dataframe in table (default value is "True").

  • corner : Accepts character to be shown on corner points (default value is "+").

  • separator : Accepts character to be shown in place to the line separating two values (default value is "|").

  • joins : Accepts character to be shown in place to the line joining two rows (default value is "-").

Passing parameter

[...]
prettyfied = pp.pretty(data = df, index = True ,corner='%', separator=';', joins='=')
print(prettyfied)

Output :

%=====%================%=========%===========%===========%
;     ;           Name ;   Class ;   Roll_no ;   Section ;
%=====%================%=========%===========%===========%
;   0 ;    Ayush kumar ;      12 ;         8 ;         A ;
%=====%================%=========%===========%===========%
;   1 ;   Prince kumar ;      12 ;        23 ;         A ;
%=====%================%=========%===========%===========%
;   2 ;   Khushi singh ;      12 ;        18 ;         B ;
%=====%================%=========%===========%===========%
;   3 ;      Prathisha ;      12 ;        23 ;         B ;
%=====%================%=========%===========%===========%

More examples

Example 1 :

Code

[...]
prettyfied = pp.pretty(data = df, corner='#')
print(prettyfied)

Output

#-----#----------------#---------#-----------#-----------#
|     |           Name |   Class |   Roll_no |   Section |
#-----#----------------#---------#-----------#-----------#
|   0 |    Ayush kumar |      12 |         8 |         A |
#-----#----------------#---------#-----------#-----------#
|   1 |   Prince kumar |      12 |        23 |         A |
#-----#----------------#---------#-----------#-----------#
|   2 |   Khushi singh |      12 |        18 |         B |
#-----#----------------#---------#-----------#-----------#
|   3 |      Prathisha |      12 |        23 |         B |
#-----#----------------#---------#-----------#-----------#

Example 2:

Code

[...]
prettyfied = pp.pretty(data = df, index = False, separator='!')
print(prettyfied)

Output

+----------------+---------+-----------+-----------+
!           Name !   Class !   Roll_no !   Section !
+----------------+---------+-----------+-----------+
!    Ayush kumar !      12 !         8 !         A !
+----------------+---------+-----------+-----------+
!   Prince kumar !      12 !        23 !         A !
+----------------+---------+-----------+-----------+
!   Khushi singh !      12 !        18 !         B !
+----------------+---------+-----------+-----------+
!      Prathisha !      12 !        23 !         B !
+----------------+---------+-----------+-----------+

Example 3 :

Code

[...]
prettyfied = pp.to_sql(data = df, index = False)
print(prettyfied)

Output

+----------------+---------+-----------+-----------+
|           Name |   Class |   Roll_no |   Section |
+----------------+---------+-----------+-----------+
|    Ayush kumar |      12 |         8 |         A |
|   Prince kumar |      12 |        23 |         A |
|   Khushi singh |      12 |        18 |         B |
|      Prathisha |      12 |        23 |         B |
+----------------+---------+-----------+-----------+

Example 4 :

Code

[...]
prettyfied = pp.to_sql(data = df, index = True)
print(prettyfied)

Output

+-----+----------------+---------+-----------+-----------+
|     |           Name |   Class |   Roll_no |   Section |
+-----+----------------+---------+-----------+-----------+
|   0 |    Ayush kumar |      12 |         8 |         A |
|   1 |   Prince kumar |      12 |        23 |         A |
|   2 |   Khushi singh |      12 |        18 |         B |
|   3 |      Prathisha |      12 |        23 |         B |
+-----+----------------+---------+-----------+-----------+

Example 5 :

Code

[...]
prettyfied = pp.tabulate(data = df, separator=':')
print(prettyfied)

Output

+-----+----------------+---------+-----------+-----------+
:     :           Name :   Class :   Roll_no :   Section :
+-----+----------------+---------+-----------+-----------+
:   0 :    Ayush kumar :      12 :         8 :         A :
:   1 :   Prince kumar :      12 :        23 :         A :
:   2 :   Khushi singh :      12 :        18 :         B :
:   3 :      Prathisha :      12 :        23 :         B :
+-----+----------------+---------+-----------+-----------+

Example 6 :

Code

[...]
prettyfied = pp.tabulate(data = df, separator=':', index = False, joins = '—', corner='#')
print(prettyfied)

Output

#————————————————#—————————#———————————#———————————#
:           Name :   Class :   Roll_no :   Section :
#————————————————#—————————#———————————#———————————#
:    Ayush kumar :      12 :         8 :         A :
:   Prince kumar :      12 :        23 :         A :
:   Khushi singh :      12 :        18 :         B :
:      Prathisha :      12 :        23 :         B :
#————————————————#—————————#———————————#———————————#

Social Handles : github | sololearn | instagram | stackoverflow


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

Pandaspretty-1.1.0.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

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

Pandaspretty-1.1.0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file Pandaspretty-1.1.0.tar.gz.

File metadata

  • Download URL: Pandaspretty-1.1.0.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for Pandaspretty-1.1.0.tar.gz
Algorithm Hash digest
SHA256 5757ab0c8fdb6e315bc8a2c8d0849434dec00d9ab8fc9e585ebd428229bf99ee
MD5 890bf1ba4736f2c0e325ad2115748d88
BLAKE2b-256 14ab4e25767f6c55641d311c39d0f7eeda8329fa8419d0c889fcc4d7b66dfee3

See more details on using hashes here.

File details

Details for the file Pandaspretty-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: Pandaspretty-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for Pandaspretty-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a24bfc4d3f88546ec8bb208db51f2bcc845e14221037eafb7faebdd6812ff51d
MD5 2d7841ed01b6fc57b705fbc610c2b517
BLAKE2b-256 5a7fac23d543826a803d8ddc91cd2d66c3c7b4ae48581c801074db1a2341709d

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