Skip to main content

biuR

An extract of the BIU R functionality, without any dependency on biu.

Install

pip install biuR

How to use

import biur.wrapper
import matplotlib.pylab as plt
import pandas as pd
R = biur.wrapper.R()

Push some data

R.push(n=5000, mean=10, var=6, question="How many apples do you eat per day?")

Run some commands

R("""
    dist <- rnorm(n, mean, var)
    print(mean(dist))
""", get=False)
[1] 9.883113

Get some data

dist = R.get("dist")
dist_alt = R("dist", get=True) # the get parameter is True by default
_ = plt.hist(dist, bins=50)

png

Do it all at the same time

dist = R("""rnorm(n, mean, var)""",
         push=dict(n=5000, mean=10, var=6, question="How many apples do you eat per day?"))
_ = plt.hist(dist, bins=50)

png

Dataframes also work as expected

df  = pd.DataFrame(dist.reshape(500,10), columns=["C%d" % (i+1) for i in range(10)])
df2 = R("""df*2""", push=dict(df=df))
df2.describe()
<style scoped> .dataframe tbody tr th:only-of-type { vertical-align: middle; }
.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}
</style>
C1 C2 C3 C4 C5 C6 C7 C8 C9 C10
count 500.000000 500.000000 500.000000 500.000000 500.000000 500.000000 500.000000 500.000000 500.000000 500.000000
mean 19.664014 19.844730 21.397676 20.316715 19.915327 20.479617 20.606811 20.671680 19.978792 20.363389
std 12.082482 11.829318 11.756079 12.228085 11.878440 12.626452 11.560421 12.360558 12.425381 12.545196
min -28.185781 -11.851668 -14.899577 -15.940758 -23.651277 -17.811376 -13.721199 -17.615716 -18.421257 -22.172515
25% 11.909300 12.042162 13.257103 12.162031 12.214617 11.778717 12.920449 12.178726 11.741882 12.254866
50% 19.316743 19.564965 20.988669 20.498992 19.765990 20.166144 20.278277 20.020587 20.054040 20.275403
75% 27.771991 28.085157 29.174137 28.447980 28.061103 28.312460 28.384447 28.869581 28.670938 29.319559
max 53.658666 59.740534 58.531887 57.402270 55.351012 52.867132 56.286094 55.596513 50.953409 58.989365

Some additional stuff

Dates

from datetime import datetime
R("""print(today)""", push=dict(today=datetime.today()), get=False)
[1] "2021-11-15 14:59:14 EET"

Dictionaries

Note that individual numbers do not exist in R (everything is a vector) so it is impossible to transform this back perfectly.

R.push(mydict={"A":10, "B":20, "C":40})
R("""
    mydict$D <- 60
    mydict""")
{'A': [10], 'B': [20], 'C': [40], 'D': [60.0]}

Metadata

Release files for biur 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for biur 0.0.1
File Size Uploaded Provenance
biur-0.0.1.tar.gz 13.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for biur 0.0.1
File Interpreter ABI Platform
biur-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 23.9 kB

Release files / biur-0.0.1.tar.gz

Download URL biur-0.0.1.tar.gz
Size 13.1 kB
Tags Source
SHA-256 checksum
How to use checksums
1965a3c2772c34575427702d9a36be375ac30795ae6365476005db091e4b9cef
BLAKE2b-256 checksum
How to use checksums
081d69f64a1d24395d912b9af902fef1e75748bb041497966fad183a9ea8f7de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

Release files / biur-0.0.1-py3-none-any.whl

Download URL biur-0.0.1-py3-none-any.whl
Size 10.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3d3688bd86fb47a457ed522de6c60c524f31852eb632e97fbe408fba8de9bc47
BLAKE2b-256 checksum
How to use checksums
ea513166269877a4604605a5f875743664265e587317a385e906a96313795207
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

Security for biur 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page