Skip to main content

Pandas DataFrames / Pandas Series / Print colored Numpy arrays / lists / dicts / tuples!

Project description

**Print colored Numpy arrays / pandas DataFrames / Pandas Series / lists / dicts / tuples! **

pip install PrettyColorPrinter

This is everything you have to do to use PrettyColorPrinter with pandas

from a_pandas_ex_color_print import add_printer

add_printer() #This function will add some methods to PandasObject



#Let’s import pandas and create a DataFrame:



import pandas as pd

df=pd.read_csv(r"https://github.com/pandas-dev/pandas/raw/main/doc/data/air_quality_no2_long.csv")

All methods added to pandas start either with:

  • ds_ (for DataFrames and Series)

  • s_ (only for Series)

  • d_ (only for DataFrames)

All methods that are added to PandasObject

  • ds_color_print

  • ds_color_print_all

  • d_color_print_columns

  • d_color_print_index

  • ds_color_print_all_with_break

  • ds_color_print_context

#If you want to see some examples:

from a_pandas_ex_color_print import print_test_from_pandas_github

print_test_from_pandas_github()



#If you need help

help(df.ds_color_print)

qq_ds_print(max_rows: int = 1000, max_colwidth: int = 300, repeat_cols: int = 70, asnumpy: bool = False, returndf: bool = False) -> Union[pandas.core.frame.DataFrame, pandas.core.series.Series, NoneType] method of pandas.core.frame.DataFrame instance

    Parameters

    ----------

    df : pd.DataFrame, pd.Series

        Array to print

    max_rows : int

        Stop printing after n lines (default is 1000)

    max_colwidth : int

        Width of each column (default is 300)

    repeat_cols : int (default is 70)

        Print columns again after n lines  (default is 70)

    asnumpy: bool (default is False)

        Converts pandas DataFrame to np before printing.

        If there are duplicated columns in a Pandas DataFrame,

        it changes to printasnp = True  (default is False)

    returndf:  bool (default is False)

        return the input DataFrame to allow chaining

Using PrettyColorPrinter without pandas

**

The function pdp can be used without pandas. 

Doing it this way, you are not restricted to PandasObjects.

You can print lists, dicts, tuples, np.arrays, pd.DataFrames and pd.Series

**

from a_pandas_ex_color_print import pdp

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

PrettyColorPrinter-0.2.tar.gz (31.4 kB view details)

Uploaded Source

Built Distribution

PrettyColorPrinter-0.2-py3-none-any.whl (30.1 kB view details)

Uploaded Python 3

File details

Details for the file PrettyColorPrinter-0.2.tar.gz.

File metadata

  • Download URL: PrettyColorPrinter-0.2.tar.gz
  • Upload date:
  • Size: 31.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for PrettyColorPrinter-0.2.tar.gz
Algorithm Hash digest
SHA256 6a820f62bd0bfd0483958f477068fae0bf636bdd35e22531a6dc1294489a5091
MD5 1fa0e38017e33d4b846346aa25b9bef7
BLAKE2b-256 b054ae4214de2920ad6dee6fd656c048dcd44b648074947564895e8d26036ca4

See more details on using hashes here.

File details

Details for the file PrettyColorPrinter-0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for PrettyColorPrinter-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ec82a18c6524adbd1ca5e87dd6515baecded2b11c11f8e1aaaad6abb1b46be55
MD5 39d5faecbff3fd08e22e97c06d937a2d
BLAKE2b-256 cd08657abbc472f2980067667f39562c4bef2452d018b36d2cbf461e673d5c46

See more details on using hashes here.

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