Metadata-Version: 2.4
Name: tidypolars-extra
Version: 0.1.0
Summary: An extension to tidypolars4sci with additional functionalities for scientific data analysis.
Project-URL: Homepage, https://github.com/mdmanurung/tidypolars-extra
Project-URL: Documentation, https://github.com/mdmanurung/tidypolars-extra
Project-URL: Changelog, https://github.com/mdmanurung/tidypolars-extra/blob/master/CHANGELOG.md
Project-URL: Issues, https://github.com/mdmanurung/tidypolars-extra/issues/
Author-email: Diogo Ferrari <diogoferrari@gmail.com>
Maintainer-email: Michael David Manurung <mdmanurung@users.noreply.github.com>
License-Expression: MIT
License-File: LICENSE
Keywords: data science,dataframe,polars,tidy data,tidyverse
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering
Requires-Python: >=3.9
Requires-Dist: numpy
Requires-Dist: pandas
Requires-Dist: polars>=1.0
Requires-Dist: pyarrow
Requires-Dist: pyreadr
Requires-Dist: pyreadstat
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == 'dev'
Description-Content-Type: text/markdown

# tidypolars-extra

**tidypolars-extra** is an extension of [tidypolars4sci](https://github.com/DiogoFerrari/tidypolars4sci), which provides Tidyverse-like functions for data manipulation and analysis in Python using [Polars](https://github.com/pola-rs/polars) as the backend.

This project builds upon the original [tidypolars4sci](https://github.com/DiogoFerrari/tidypolars4sci) by adding extra functionalities and improvements while maintaining the same familiar API.

## Features

- Tidyverse-style API for [Polars](https://github.com/pola-rs/polars) DataFrames
- Scientific research utilities including LaTeX table generation
- Fast data manipulation powered by Polars
- Familiar R-like syntax for Python users

## Installation

You can install tidypolars-extra with `pip`:

```bash
pip install tidypolars-extra
```

## Basic usage

tidypolars-extra methods are designed to work like tidyverse functions:

```python
import tidypolars_extra as tp

# create tibble data frame
df = tp.tibble(x = range(3),
               y = range(3, 6),
               z = ['a', 'a', 'b'])

(
    df
    .select('x', 'y', 'z')
    .filter(tp.col('x') < 4, tp.col('y') > 1)
    .arrange(tp.desc('z'), 'x')
    .mutate(double_x = tp.col('x') * 2,
            x_plus_y = tp.col('x') + tp.col('y')
            )
)
┌─────┬─────┬─────┬──────────┬──────────┐
│ x   ┆ y   ┆ z   ┆ double_x ┆ x_plus_y │
│ --- ┆ --- ┆ --- ┆ ---      ┆ ---      │
│ i64 ┆ i64 ┆ str ┆ i64      ┆ i64      │
╞═════╪═════╪═════╪══════════╪══════════╡
│ 2   ┆ 5   ┆ b   ┆ 4        ┆ 7        │
├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤
│ 0   ┆ 3   ┆ a   ┆ 0        ┆ 3        │
├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤
│ 1   ┆ 4   ┆ a   ┆ 2        ┆ 5        │
└─────┴─────┴─────┴──────────┴──────────┘

```

## Converting to/from pandas data frames

If you need to use a package that requires pandas or polars data frames, you can convert from a tidypolars_extra `tibble` to either of those `DataFrame` formats.

```python
# convert to pandas...
df = df.to_pandas()
# ... or convert to polars
df = df.to_polars()
```

To convert from a pandas or polars `DataFrame` to a tidypolars `tibble`:

```python
# convert from pandas...
df = tp.from_pandas(df)
# or covert from polars
df = tp.from_polars(df)
```

## Acknowledgments

This project is an extension of:
- [tidypolars4sci](https://github.com/DiogoFerrari/tidypolars4sci) by Diogo Ferrari
- [tidypolars](https://pypi.org/project/tidypolars/) — the original starting point
