Highly customizable JSON objects and dataframes.
Project description
jsonr - PyPi
flowa: (V8.5.2)
Python Highly customizable JSON objects and dataframes, and more!
Installing
# Linux/macOS
python3 pip install -U jsonr
# Windows
py -3 -m pip install -U jsonr
JSON Objects
import jsonr
json: jsonr.JSON = jsonr.New(auto=True, some_var='thanks for using jsonr!', other_var='im a random var!', lol='lol')
// >>> {'some_var': 'thanks for using jsonr!', 'other_var': 'im a random var!', 'lol': 'lol'}
json.test: int = 123
print(json['test'])
// >>> 123
json_copy: dict = json.copy()
new_json: jsonr.JSON = jsonr.New()
new_json.to(json_copy)
print(new_json)
// >>> {'some_var': 'thanks for using jsonr!', 'other_var': 'im a random var!', 'lol': 'lol', 'test': 123}
json.wipe()
// >>> {}
For more JSON Object Examples view the jsonr/examples
DataFrame Objects
frame = jsonr.Frame(columns=["1A TEST-A", "B", "C"], rows=[[1, 2, 3], [4, 5, 6]])
// >>> | 1A TEST-A | B | C
// >>> -----------------------
// >>> 0 | 1 | 2 | 3
// >>> 1 | 4 | 5 | 6
print(frame._1A_TEST_A)
// >>> [1, 4]
frame.add_row([7, 8, 9])
// >>> | 1A TEST-A | B | C
// >>> -----------------------
// >>> 0 | 1 | 2 | 3
// >>> 1 | 4 | 5 | 6
// >>> 2 | 7 | 8 | 9
frame.add_column("D", [10, 11, 12])
// >>> | 1A TEST-A | B | C | D
// >>> ----------------------------
// >>> 0 | 1 | 2 | 3 | 10
// >>> 1 | 4 | 5 | 6 | 11
// >>> 2 | 7 | 8 | 9 | 12
X: list = frame.drop(columns=['B', 'C']) # Creates a new dataframe to not alter the original frame.
// >>> | 1A TEST-A | D
// >>> --------------------
// >>> 0 | 1 | 10
// >>> 1 | 4 | 11
// >>> 2 | 7 | 12
print(frame.describe())
// >>> {'1A TEST-A': {'count': 3, 'mean': 4.0, 'std': 2.449489742783178, 'min': 1, '25%': 1, '50%': 4, '75%': 7, 'max': 7}, 'B': {'count': 3, 'mean': 5.0, 'std': 2.449489742783178, 'min': 2, '25%': 2, '50%': 5, '75%': 8, 'max': 8}, 'C': {'count': 3, 'mean': 6.0, 'std': 2.449489742783178, 'min': 3, '25%': 3, '50%': 6, '75%': 9, 'max': 9}, 'D': {'count': 3, 'mean': 11.0, 'std': 0.816496580927726, 'min': 10, '25%': 10, '50%': 11, '75%': 12, 'max': 12}}
For more DataFrame Object Examples view the jsonr/examples
Links
GitHub = https://github.com/jsonr-py Repository = https://github.com/jsonr-py/jsonr PyPi = https://pypi.org/project/jsonr
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
jsonr-8.5.2.tar.gz
(11.0 kB
view hashes)
Built Distribution
jsonr-8.5.2-py3-none-any.whl
(11.3 kB
view hashes)