180505 如何将dataframe转换成mat格式的文件

这里写图片描述

# load prediction data and save it as .mat file
import scipy
def SaveMat(sorted_data):
    # transfer the data type
    sorted_data['pre'] = sorted_data['pre'].astype(int)
    # save the prediction data and remember to resave it in matlab for memory saving 
    b_dict = {col_name : sorted_data[col_name].values for col_name in sorted_data.columns.values}
    scipy.io.savemat('nfac-pre.mat', {'struct':b_dict})

猜你喜欢

转载自blog.csdn.net/qq_33039859/article/details/80214122
今日推荐