mlshapiro / read-protobuf Goto Github PK
View Code? Open in Web Editor NEWSmall library to read serialized protobuf(s) directly into Pandas Dataframe
License: MIT License
Small library to read serialized protobuf(s) directly into Pandas Dataframe
License: MIT License
File "/Users/vivek/PycharmProjects/TestCodes/codes/protobuf/test_person.py", line 145, in <module>
df = read_protobuf(person_ser, new_person, flatten=True, prefix_nested=True)
File "/Users/vivek/PycharmProjects/TestCodes/venv/lib/python2.7/site-packages/read_protobuf.py", line 143, in read_protobuf
df = pd.DataFrame(data)
File "/Users/vivek/PycharmProjects/TestCodes/venv/lib/python2.7/site-packages/pandas/core/frame.py", line 348, in __init__
mgr = self._init_dict(data, index, columns, dtype=dtype)
File "/Users/vivek/PycharmProjects/TestCodes/venv/lib/python2.7/site-packages/pandas/core/frame.py", line 459, in _init_dict
return _arrays_to_mgr(arrays, data_names, index, columns, dtype=dtype)
File "/Users/vivek/PycharmProjects/TestCodes/venv/lib/python2.7/site-packages/pandas/core/frame.py", line 7356, in _arrays_to_mgr
index = extract_index(arrays)
File "/Users/vivek/PycharmProjects/TestCodes/venv/lib/python2.7/site-packages/pandas/core/frame.py", line 7393, in extract_index
raise ValueError('If using all scalar values, you must pass'
ValueError: If using all scalar values, you must pass an index
hi!This library does a very good job of implementing the relevant functionality, but in the ipynb file, i see %time
to calculate running time. It may be not very accurate, is it possible to compare his performance after a more accurate test?It doesn't really matter how fast it is, often the write and read times are acceptable, just exploring if there is a faster way to implement based on python.
Hi, read-protobuf is more like a deserializer. I am wondering if it is possible to implement a serializer along with it. Is that more difficult?
Another option (perhaps better than the MessageToJson
option) is to use the following code:
from google.protobuf.json_format import MessageToDict
proto_dict = MessageToDict(proto_obj)
Source: https://googleapis.dev/python/protobuf/latest/google/protobuf/json_format.html
I get the following error while using read_protobuf:
File "/usr/local/lib/python2.7/dist-packages/read_protobuf.py", line 143, in read_protobuf
df = pd.DataFrame(data)
File "/usr/local/lib/python2.7/dist-packages/pandas/core/frame.py", line 348, in init
mgr = self._init_dict(data, index, columns, dtype=dtype)
File "/usr/local/lib/python2.7/dist-packages/pandas/core/frame.py", line 459, in _init_dict
return _arrays_to_mgr(arrays, data_names, index, columns, dtype=dtype)
File "/usr/local/lib/python2.7/dist-packages/pandas/core/frame.py", line 7356, in _arrays_to_mgr
index = extract_index(arrays)
File "/usr/local/lib/python2.7/dist-packages/pandas/core/frame.py", line 7393, in extract_index
raise ValueError('If using all scalar values, you must pass'
ValueError: If using all scalar values, you must pass an index
It appears that this library breaks with protobuf>=4.0.0
It would be awesome if you could upgrade support to the latest protobuf library
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.