I currently interface to a server that provides protocol buffers. I can potentially receive a very large number of messages. Currently my process to read the protocol buffers and convert them to a Pandas DataFrame (not a necessary step in general, but Pandas offers nice tools for analyzing datasets) is:
- Read protocol buffer, it will be a google protobuf object
- Convert protocol buffers to dictionary using protobuf_to_dict
- use
pandas.DataFrame.from_recordsto get a DataFrame
This works great, but, given the large number of messages I read from the protobuf, it is quite inefficient to convert to dictionary and then to pandas. My question is: is it possible to make a class that can make a python protobuf object look like a dictionary? That is, remove step 2. Any references or pseudocode would be helpful.
Convert protocol buffers to dictionarymakes a python protobuf object look like a dictionary ;) You rather need somepandas.DataFrame.from_protbufbut I don't know answer for this problem. - furas