tidy-viewer-py


Nametidy-viewer-py JSON
Version 0.3.0 PyPI version JSON
download
home_pageNone
SummaryA cross-platform data pretty printer that uses column styling to maximize viewer enjoyment. Supports CSV, Parquet, Pandas, and Polars DataFrames with automatic data type detection and display.
upload_time2025-08-20 23:39:52
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT OR Apache-2.0
keywords table formatting terminal pretty-print csv parquet
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Tidy Viewer Py

## Installation

```bash
pip install tidy-viewer-py
```

## Quick Start

### CSV File Pretty Printing

```python
import tidy_viewer_py as tv
import pandas as pd
url = "https://raw.githubusercontent.com/mwaskom/seaborn-data/master/iris.csv"
pd.read_csv(url).to_csv("iris.csv", index=False)  # Save to csv for demo
filename = "iris.csv"
tv.print_csv(filename)
```

### Pandas DataFrames Pretty Printing

```python
import pandas as pd
import tidy_viewer_py as tv
df = pd.read_csv(filename)
tv.print_dataframe(df)
```

### Polars DataFrames Pretty Printing

```python
import polars as pl

df_pl = pl.read_csv(filename)
tv.print_polars_dataframe(df_pl)
```

### Method Chaining API

```python
import tidy_viewer_py as tv

tv.tv().color_theme("gruvbox").max_rows(10).print_dataframe(df)
```

## Configuration Options

```python
options = tv.FormatOptions(
    # Display options
    max_rows=25,              # Maximum rows to display (None for all)
    max_col_width=20,         # Maximum column width
    min_col_width=2,          # Minimum column width
    
    # Styling
    use_color=True,           # Enable/disable colored output
    color_theme="nord",       # Color theme
    
    # Data formatting
    delimiter=",",            # CSV delimiter
    significant_figures=3,    # Number of significant figures
    preserve_scientific=False,# Preserve scientific notation
    max_decimal_width=13,     # Max width before scientific notation
    
    # Table elements
    no_dimensions=False,      # Hide table dimensions
    no_row_numbering=False,   # Hide row numbers
    title="My Table",         # Table title
    footer="End of data",     # Table footer
)
```

## Data Type Display

Tidy Viewer Py can display data types from various dataframe libraries in an abbreviated format. Data types appear as a row below the headers with slightly dimmed styling.

### Automatic Data Type Detection

```python
import pandas as pd
import tidy_viewer_py as tv

# Pandas DataFrame with automatic data type display
df = pd.DataFrame({
    'name': ['Alice', 'Bob', 'Charlie'],
    'age': [25, 30, 35],
    'salary': [50000.0, 60000.0, 70000.0],
    'active': [True, False, True]
})

# Data types are automatically detected and displayed
tv.print_dataframe(df)
```

### Manual Data Type Specification

```python
import tidy_viewer_py as tv

data = [['Alice', '25', 'Engineer'], ['Bob', '30', 'Designer']]
headers = ['Name', 'Age', 'Role']
data_types = ['<str>', '<i64>', '<str>']

# Specify data types manually
tv.print_table(data, headers, data_types)
```

### Data Type Mapping

The library automatically maps data types from different dataframe libraries to abbreviated format:

#### Pandas Data Types
| Pandas Type | Abbreviated |
|-------------|-------------|
| `object` | `<str>` |
| `int64` | `<i64>` |
| `float64` | `<f64>` |
| `bool` | `<bool>` |
| `datetime64[ns]` | `<dt>` |
| `category` | `<cat>` |
| `complex128` | `<cplx>` |

#### Polars Data Types
| Polars Type | Abbreviated |
|-------------|-------------|
| `String` | `<str>` |
| `Int64` | `<i64>` |
| `Float64` | `<f64>` |
| `Boolean` | `<bool>` |
| `Datetime` | `<dt>` |
| `Categorical` | `<cat>` |
| `List<Int64>` | `<list<i64>>` |

#### Arrow Data Types
| Arrow Type | Abbreviated |
|------------|-------------|
| `Utf8` | `<str>` |
| `Int64` | `<i64>` |
| `Float64` | `<f64>` |
| `Boolean` | `<bool>` |
| `Timestamp` | `<dt>` |
| `List` | `<list>` |
| `Struct` | `<struct>` |

### Complex Type Handling

Complex data types are automatically simplified:

```python
# These complex types are simplified:
# List<Int64> → <list<i64>>
# Struct<field1: String, field2: Int64> → <struct>
# Map<String, Int64> → <map>
# Union<Int64, String> → <union>
# Int64? → <i64> (nullable types)
```

### Data Type Utilities

```python
from tidy_viewer_py import map_dtype, map_dtypes, auto_map_dtypes

# Map individual data types
map_dtype('int64', 'pandas')  # Returns '<i64>'
map_dtype('String', 'polars')  # Returns '<str>'

# Map lists of data types
dtypes = ['object', 'int64', 'float64']
mapped = map_dtypes(dtypes, 'pandas')  # Returns ['<str>', '<i64>', '<f64>']

# Auto-detect library and map
auto_mapped = auto_map_dtypes(dtypes)  # Automatically detects pandas
```

## Color Themes

Available themes:
- `nord` (default) - Arctic, north-bluish color palette
- `gruvbox` - Retro groove color scheme
- `dracula` - Dark theme with vibrant colors
- `one_dark` - Atom One Dark inspired
- `solarized_light` - Precision colors for readability


### Building from Source

Requirements:
- Python 3.8+
- Rust 1.70+
- uv (recommended) or pip

```bash
git clone https://github.com/yourusername/tidy-viewer-py
cd tidy-viewer-py
uv pip install .
```


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "tidy-viewer-py",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "table, formatting, terminal, pretty-print, csv, parquet",
    "author": null,
    "author_email": "Alex Hallam <alexhallam6.28@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/7b/82/bd6797f2f06b8e713b26b8a9b88e881d6283399cf4f64c9fe5f80d06a7ed/tidy_viewer_py-0.3.0.tar.gz",
    "platform": null,
    "description": "# Tidy Viewer Py\n\n## Installation\n\n```bash\npip install tidy-viewer-py\n```\n\n## Quick Start\n\n### CSV File Pretty Printing\n\n```python\nimport tidy_viewer_py as tv\nimport pandas as pd\nurl = \"https://raw.githubusercontent.com/mwaskom/seaborn-data/master/iris.csv\"\npd.read_csv(url).to_csv(\"iris.csv\", index=False)  # Save to csv for demo\nfilename = \"iris.csv\"\ntv.print_csv(filename)\n```\n\n### Pandas DataFrames Pretty Printing\n\n```python\nimport pandas as pd\nimport tidy_viewer_py as tv\ndf = pd.read_csv(filename)\ntv.print_dataframe(df)\n```\n\n### Polars DataFrames Pretty Printing\n\n```python\nimport polars as pl\n\ndf_pl = pl.read_csv(filename)\ntv.print_polars_dataframe(df_pl)\n```\n\n### Method Chaining API\n\n```python\nimport tidy_viewer_py as tv\n\ntv.tv().color_theme(\"gruvbox\").max_rows(10).print_dataframe(df)\n```\n\n## Configuration Options\n\n```python\noptions = tv.FormatOptions(\n    # Display options\n    max_rows=25,              # Maximum rows to display (None for all)\n    max_col_width=20,         # Maximum column width\n    min_col_width=2,          # Minimum column width\n    \n    # Styling\n    use_color=True,           # Enable/disable colored output\n    color_theme=\"nord\",       # Color theme\n    \n    # Data formatting\n    delimiter=\",\",            # CSV delimiter\n    significant_figures=3,    # Number of significant figures\n    preserve_scientific=False,# Preserve scientific notation\n    max_decimal_width=13,     # Max width before scientific notation\n    \n    # Table elements\n    no_dimensions=False,      # Hide table dimensions\n    no_row_numbering=False,   # Hide row numbers\n    title=\"My Table\",         # Table title\n    footer=\"End of data\",     # Table footer\n)\n```\n\n## Data Type Display\n\nTidy Viewer Py can display data types from various dataframe libraries in an abbreviated format. Data types appear as a row below the headers with slightly dimmed styling.\n\n### Automatic Data Type Detection\n\n```python\nimport pandas as pd\nimport tidy_viewer_py as tv\n\n# Pandas DataFrame with automatic data type display\ndf = pd.DataFrame({\n    'name': ['Alice', 'Bob', 'Charlie'],\n    'age': [25, 30, 35],\n    'salary': [50000.0, 60000.0, 70000.0],\n    'active': [True, False, True]\n})\n\n# Data types are automatically detected and displayed\ntv.print_dataframe(df)\n```\n\n### Manual Data Type Specification\n\n```python\nimport tidy_viewer_py as tv\n\ndata = [['Alice', '25', 'Engineer'], ['Bob', '30', 'Designer']]\nheaders = ['Name', 'Age', 'Role']\ndata_types = ['<str>', '<i64>', '<str>']\n\n# Specify data types manually\ntv.print_table(data, headers, data_types)\n```\n\n### Data Type Mapping\n\nThe library automatically maps data types from different dataframe libraries to abbreviated format:\n\n#### Pandas Data Types\n| Pandas Type | Abbreviated |\n|-------------|-------------|\n| `object` | `<str>` |\n| `int64` | `<i64>` |\n| `float64` | `<f64>` |\n| `bool` | `<bool>` |\n| `datetime64[ns]` | `<dt>` |\n| `category` | `<cat>` |\n| `complex128` | `<cplx>` |\n\n#### Polars Data Types\n| Polars Type | Abbreviated |\n|-------------|-------------|\n| `String` | `<str>` |\n| `Int64` | `<i64>` |\n| `Float64` | `<f64>` |\n| `Boolean` | `<bool>` |\n| `Datetime` | `<dt>` |\n| `Categorical` | `<cat>` |\n| `List<Int64>` | `<list<i64>>` |\n\n#### Arrow Data Types\n| Arrow Type | Abbreviated |\n|------------|-------------|\n| `Utf8` | `<str>` |\n| `Int64` | `<i64>` |\n| `Float64` | `<f64>` |\n| `Boolean` | `<bool>` |\n| `Timestamp` | `<dt>` |\n| `List` | `<list>` |\n| `Struct` | `<struct>` |\n\n### Complex Type Handling\n\nComplex data types are automatically simplified:\n\n```python\n# These complex types are simplified:\n# List<Int64> \u2192 <list<i64>>\n# Struct<field1: String, field2: Int64> \u2192 <struct>\n# Map<String, Int64> \u2192 <map>\n# Union<Int64, String> \u2192 <union>\n# Int64? \u2192 <i64> (nullable types)\n```\n\n### Data Type Utilities\n\n```python\nfrom tidy_viewer_py import map_dtype, map_dtypes, auto_map_dtypes\n\n# Map individual data types\nmap_dtype('int64', 'pandas')  # Returns '<i64>'\nmap_dtype('String', 'polars')  # Returns '<str>'\n\n# Map lists of data types\ndtypes = ['object', 'int64', 'float64']\nmapped = map_dtypes(dtypes, 'pandas')  # Returns ['<str>', '<i64>', '<f64>']\n\n# Auto-detect library and map\nauto_mapped = auto_map_dtypes(dtypes)  # Automatically detects pandas\n```\n\n## Color Themes\n\nAvailable themes:\n- `nord` (default) - Arctic, north-bluish color palette\n- `gruvbox` - Retro groove color scheme\n- `dracula` - Dark theme with vibrant colors\n- `one_dark` - Atom One Dark inspired\n- `solarized_light` - Precision colors for readability\n\n\n### Building from Source\n\nRequirements:\n- Python 3.8+\n- Rust 1.70+\n- uv (recommended) or pip\n\n```bash\ngit clone https://github.com/yourusername/tidy-viewer-py\ncd tidy-viewer-py\nuv pip install .\n```\n\n",
    "bugtrack_url": null,
    "license": "MIT OR Apache-2.0",
    "summary": "A cross-platform data pretty printer that uses column styling to maximize viewer enjoyment. Supports CSV, Parquet, Pandas, and Polars DataFrames with automatic data type detection and display.",
    "version": "0.3.0",
    "project_urls": {
        "Homepage": "https://github.com/yourusername/tidy-viewer-py",
        "Issues": "https://github.com/yourusername/tidy-viewer-py/issues",
        "Repository": "https://github.com/yourusername/tidy-viewer-py"
    },
    "split_keywords": [
        "table",
        " formatting",
        " terminal",
        " pretty-print",
        " csv",
        " parquet"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "ecb74bd1d9f37932ff0bc5167e4730e4e7539950699fb64db60425463a3256c1",
                "md5": "efb3947c828ae283557ec83146d45c5f",
                "sha256": "676e490f7a2932e16fce2bc02427e3048c1c4ebd976c272e18d1de2f07cdf568"
            },
            "downloads": -1,
            "filename": "tidy_viewer_py-0.3.0-cp313-cp313-macosx_11_0_arm64.whl",
            "has_sig": false,
            "md5_digest": "efb3947c828ae283557ec83146d45c5f",
            "packagetype": "bdist_wheel",
            "python_version": "cp313",
            "requires_python": ">=3.8",
            "size": 2455352,
            "upload_time": "2025-08-20T23:37:33",
            "upload_time_iso_8601": "2025-08-20T23:37:33.372083Z",
            "url": "https://files.pythonhosted.org/packages/ec/b7/4bd1d9f37932ff0bc5167e4730e4e7539950699fb64db60425463a3256c1/tidy_viewer_py-0.3.0-cp313-cp313-macosx_11_0_arm64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "7b82bd6797f2f06b8e713b26b8a9b88e881d6283399cf4f64c9fe5f80d06a7ed",
                "md5": "214a4dcedc51331b1a7a3bfc1c94e4d9",
                "sha256": "d8619641fce96349096fef414d656fb30ea08ab0d3e67b649562293b4abe27a0"
            },
            "downloads": -1,
            "filename": "tidy_viewer_py-0.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "214a4dcedc51331b1a7a3bfc1c94e4d9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 143951,
            "upload_time": "2025-08-20T23:39:52",
            "upload_time_iso_8601": "2025-08-20T23:39:52.764369Z",
            "url": "https://files.pythonhosted.org/packages/7b/82/bd6797f2f06b8e713b26b8a9b88e881d6283399cf4f64c9fe5f80d06a7ed/tidy_viewer_py-0.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-20 23:39:52",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "yourusername",
    "github_project": "tidy-viewer-py",
    "github_not_found": true,
    "lcname": "tidy-viewer-py"
}
        
Elapsed time: 2.97774s