参考:
....import numpy as np
import pandas as pd from pandas import Series,DataFrame from numpy import nan as NaNimport tensorflow as tf
import matplotlib.pyplot as pltimport scipy.io as sio
import osfrom sklearn import preprocessing
读取mat数据
load_path="08_1.mat" load_data = sio.loadmat(load_path) a = load_data['D'] print(a)data = DataFrame(a)
print(data)data.fillna(0)
print(data.fillna(0))b=data.fillna(0).values
print(b)数据归一化
a2 = preprocessing.scale(b) print('数据归一化:') print(a2)数据清洗方法2 删除NAN所在的列
load_path2="08_1.mat"
load_data2 = sio.loadmat(load_path2) a2 = load_data2['D']print(a2)
data2 = DataFrame(a2)
data2.dropna(axis=0, how='any')print(data2.dropna(axis=0, how='any'))`
处理前:
处理后: