Skip to main content

Powerful package to prettify DataFrame into table.

Project description

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.

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 

Parameters :

  • data : Accepts a dataframe object.

  • 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, corner='%', separator=';', joins='=')
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 examples

Example 1 :

Code

[...]
prettyfied = pp.pretty(data = df, 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 |
#----------------#---------#-----------#-----------#

Example 2:

Code

[...]
prettyfied = pp.pretty(data = df, 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.pretty(data = df, joins='~')
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.0.0.tar.gz (2.9 kB view hashes)

Uploaded Source

Built Distribution

Pandaspretty-1.0.0-py3-none-any.whl (3.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page