https://github.com/oneoffcoder/pyspark-formula
R-like formula approach to Spark Dataframes
https://github.com/oneoffcoder/pyspark-formula
classification clustering dataframes interaction-design patsy pyspark regression rlike-formulas spark
Last synced: 12 months ago
JSON representation
R-like formula approach to Spark Dataframes
- Host: GitHub
- URL: https://github.com/oneoffcoder/pyspark-formula
- Owner: oneoffcoder
- License: apache-2.0
- Created: 2020-12-06T22:19:36.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2020-12-10T17:12:40.000Z (over 5 years ago)
- Last Synced: 2025-04-13T06:03:57.380Z (12 months ago)
- Topics: classification, clustering, dataframes, interaction-design, patsy, pyspark, regression, rlike-formulas, spark
- Language: Python
- Homepage:
- Size: 167 KB
- Stars: 10
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE.txt
Awesome Lists containing this project
README

# ydot
R-like formulas for Spark Dataframes.
- [Documentation](https://ydot.readthedocs.io/)
- [PyPi](https://pypi.org/project/ydot/)
- [Gitter](https://gitter.im/dataflava/ydot)
Now you have the expressive power of R-like formulas to produce design matrices for your experimental needs. This API is based off of [patsy](https://patsy.readthedocs.io/en/latest/), but for use with Apache Spark dataframes. Given a Spark dataframe, you can express your design matrices with something that resembles the following.
`y ~ x1 + x2 + (x3 + a + b)**2`
Here's a short and sweet example.
```python
from ydot.spark import smatrices
spark_df = get_a_spark_dataframe()
formula = 'y ~ x1 + x2 + (x3 + a + b)**2'
y, X = smatrices(formula, spark_df)
```
# Software Copyright
```
Copyright 2020 One-Off Coder
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```
# Book Copyright
Copyright 2020 One-Off Coder
This work is licensed under a [Creative Commons Attribution 4.0 International License](https://creativecommons.org/licenses/by/4.0/) by [One-Off Coder](https://www.oneoffcoder.com).

# Art Copyright
Copyright 2020 Daytchia Vang
# Citation
```
@misc{oneoffcoder_ydot_2020,
title={ydot, R-like formulas for Spark Dataframes},
url={https://github.com/oneoffcoder/pyspark-formula},
author={Jee Vang},
year={2020},
month={Dec}}
```
# Sponsor, Love
- [Patreon](https://www.patreon.com/vangj)
- [GitHub](https://github.com/sponsors/vangj)