All Projects → mlshapiro → read-protobuf

mlshapiro / read-protobuf

Licence: other
Small library to read serialized protobuf(s) directly into Pandas Dataframe

Programming Languages

python
139335 projects - #7 most used programming language
Jupyter Notebook
11667 projects

Projects that are alternatives of or similar to read-protobuf

elm-protobuf
protobuf plugin for elm
Stars: ✭ 93 (+232.14%)
Mutual labels:  protobuf
django-model-values
Taking the O out of ORM.
Stars: ✭ 57 (+103.57%)
Mutual labels:  pandas
yages
Yet another gRPC echo server (YAGES)
Stars: ✭ 28 (+0%)
Mutual labels:  protobuf
protoactor-python
Proto Actor - Ultra fast distributed actors
Stars: ✭ 78 (+178.57%)
Mutual labels:  protobuf
powerproto
🎉 An awesome version control tool for protoc and its related plugins.
Stars: ✭ 161 (+475%)
Mutual labels:  protobuf
ProtobufDecoder
A Google Protocol Buffers (Protobuf) payload decoder/analyzer
Stars: ✭ 33 (+17.86%)
Mutual labels:  protobuf
methanol
⚗️ Lightweight HTTP extensions for Java
Stars: ✭ 172 (+514.29%)
Mutual labels:  protobuf
protobuf-example-java
Companion Repository for my Protocol Buffers course
Stars: ✭ 67 (+139.29%)
Mutual labels:  protobuf
proto2gql
The project has been migrated to https://github.com/EGT-Ukraine/go2gql.
Stars: ✭ 21 (-25%)
Mutual labels:  protobuf
api
Speechly public API definitions and generated code
Stars: ✭ 15 (-46.43%)
Mutual labels:  protobuf
RentHouseWeb
使用 go+docker+go-micro微服务框架开发的租房网系统,符合RESTful架构风格。
Stars: ✭ 28 (+0%)
Mutual labels:  protobuf
skutil
NOTE: skutil is now deprecated. See its sister project: https://github.com/tgsmith61591/skoot. Original description: A set of scikit-learn and h2o extension classes (as well as caret classes for python). See more here: https://tgsmith61591.github.io/skutil
Stars: ✭ 29 (+3.57%)
Mutual labels:  pandas
Bynar
Server remediation as a service
Stars: ✭ 53 (+89.29%)
Mutual labels:  protobuf
scalapb-circe
Json/Protobuf convertors for ScalaPB use circe
Stars: ✭ 38 (+35.71%)
Mutual labels:  protobuf
fer
Facial Expression Recognition
Stars: ✭ 32 (+14.29%)
Mutual labels:  pandas
protobuf-maven-plugin
Maven Plugin that executes the Protocol Buffers (protoc) compiler
Stars: ✭ 204 (+628.57%)
Mutual labels:  protobuf
Chatistics
A WhatsApp Chat analyzer and statistics.
Stars: ✭ 32 (+14.29%)
Mutual labels:  pandas
hh research
Автоматизация поиска и исследования вакансий с сайта hh.ru (Headhunter) с помощью методов Python. Классификация данных, поиск статистических параметров.
Stars: ✭ 36 (+28.57%)
Mutual labels:  pandas
anesthetic
Nested Sampling post-processing and plotting
Stars: ✭ 34 (+21.43%)
Mutual labels:  pandas
Algorithmic-Trading
Algorithmic trading using machine learning.
Stars: ✭ 102 (+264.29%)
Mutual labels:  pandas

read-protobuf

Small library to read serialized protobuf(s) directly into Pandas Dataframe.

This is meant to be a simple shortcut to getting from serialized protobuf bytes / files directly to a dataframe.

Runs in Python 2.7+ and Python 3

Note: This currently only supports basic proto3. I have not yet tested it with proto2, though I believe that should work. I plan to expand the utility of this library with time and need.

Install

Available via pip:

$ pip install read-protobuf

Usage

Run the demo-notebook for an interactive demo.

import demo_pb2                             # compiled protobuf message module 
from read_protobuf import read_protobuf

MessageType = demo_pb2.MessageType()        # instantiate a new message type
df = read_protobuf(b'\x00\x00', MessageType)    # create a dataframe from serialized protobuf bytes
df = read_protobuf([b'\x00\x00', b'x00\x00'] MessageType)    # read multiple protobuf bytes

df = read_protobuf('demo.pb', MessageType)    # use file instead of bytes
df = read_protobuf(['demo.pb', 'demo2.pb'], MessageType)    # read multiple files

# options
df = read_protobuf('demo.pb', MessageType, flatten=False)    # don't flatten pb messages
df = read_protobuf('demo.pb', MessageType, prefix_nested=True)    # prefix nested messages with parent keys (like pandas.io.json.json_normalize)

To compile a protobuf Message class from python, use:

$ protoc --python_out="." demo.proto

Alternatives

protobuf-to-dict

https://github.com/benhodgson/protobuf-to-dict

This library was developed earlier to convert protobufs to JSON via a dict.

JSON

The google protobuf library comes with a utility to convert messages to JSON. Then the JSON objects could be loaded into pands via pd.read_json().

from google.protobuf.json_format import MessageToJson

In my brief tests, the read_protobuf package is about twice as fast as converting a protobuf to a dataframe using MessageToJson.

Develop

Currently developed for Python 3 using the anaconda python distribution. To install a development version of the package, run from the root directory:

$ pip install -e .
  • To install development dependencies, use pip on the dev-requirements.txt file:
$ pip install -r dev-requirements.txt

Lint

Uses pylint to lint application.

$ pylint read_protobuf

Configuration options are specified in .pylintrc

Test

Uses pytest to run unit tests. From the root of the repository, run:

$ pytest
$ pytest -k "TestRead::test_read_bytes"    # specify test

Configuration options are specified in setup.cfg

Code Coverage

We use coverage to monitor code coverage during tests. To record coverage while running tests, run:

$ coverage run -m pytest        # watch files while testing
$ coverage report               # will display coverage report

UnLicense

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to http://unlicense.org/

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].