pandas - How do I decode a msgpack file in Python? -


i've created msgpack file pandas dataframe, using following code:

df.to_msgpack('ixto.msg') 

i've confirmed file saved in directory, can't use msgpack library python since following code:

unp = msgpack.unpackb('ixto.msg') 

gives me following error:

attributeerror: 'str' object has no attribute 'read' 

msgpack.unpackb expects bytes (thus "b") containing encoded data, , you're giving name of file containing data.

so need read file first :

with open('ixto.msg', 'rb') f:     unp = msgpack.unpackb(f.read()) 

Comments

Popular posts from this blog

Capture and play voice with Asterisk ARI -

java - Why database contraints in HSQLDB are only checked during a commit when using transactions in Hibernate? -

visual studio - Installing Packages through Nuget - "Central Directory corrupt" -