https://github.com/andrewrgarcia/ponte
A Python mini-library to process arrays to .json files and viceversa. See bridge for full application.
https://github.com/andrewrgarcia/ponte
json python
Last synced: 3 months ago
JSON representation
A Python mini-library to process arrays to .json files and viceversa. See bridge for full application.
- Host: GitHub
- URL: https://github.com/andrewrgarcia/ponte
- Owner: andrewrgarcia
- Created: 2022-07-19T01:08:52.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2022-07-19T01:16:32.000Z (almost 3 years ago)
- Last Synced: 2025-02-17T08:47:05.901Z (3 months ago)
- Topics: json, python
- Language: Python
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ponte
A mini-library to process arrays to .json files and viceversa. Developed to pass arrays between Python and C++ through the use of json DOK files.
## Installation
```ruby
pip install ponte
```## Contributors
- [Andrew Garcia](https://github.com/andrewrgarcia) - creator and maintainer
## Contributing
1. Fork it ()
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request## Usage Example
For full application, i.e. passing array structures between Python and C++ code, see [bridge](https://github.com/andrewrgarcia/bridge)
Try running this code in a terminal
```ruby
import ponte as bridge
import numpy as np'CREATE A 1-D VECTOR'
X = np.random.choice([0,1,2,3],10,p=[0.7,0.1,0.1,0.1])
'pack vector to .json file'
bridge.tojson('sample.json',X)'PROCESS JSON FILE BACK TO VECTOR'
array_form = bridge.jsonload('sample.json')
'print vector'
print('array:\n',array_form)
```