NumPy

Cross-Read & -Write R, Py, Matlab, Binary Files

2016-06-01. Category & Tags: R, Binary, Mat, Matlab, Python, NumPy, Pandas

Note: feather-format is desigend to transfer data between Py & R [stackoverflow, feather-doc].

.FE #

OBS: only for data.frame type, not even arrays.

py (feather-format) #

Requires: pip install feather-format. (OBS: feather-format NOT feather.)

write:

import numpy as np
import pandas as pd

df = pd.DataFrame({'A': [1, 2, 3], 'B': [4, 5, 6], 'C':[7,8,9]}, index=['one', 'two', 'three'])

import feather
feather.write_dataframe(df.reset_index(drop=True), 'df.fe')

(though the df is created by pandas)

read:

import feather
df = feather.read_dataframe('df.fe')

py-pandas (canNOT read) #

write: df.reset_index(drop=True).to_feather('df.fe'). Note that feather canNOT handle string-based index names, another solution is drop=False, then index becomes columns.

...