csv - How to insert the values instated of csv file?
问题描述
I have this block of code, how can I replace large amount of values instated of csv file? Is that csv file values can be placed without using the csv dataset?
v= pandas.read_csv('baltic.csv',header=None); # Load the sensor and measurement data file
v=v.values
y=v[:,:3]; #define metrology or measurement matrix
x=v[:, 3:30]; #obtain process sensor data matrix
##Normalize input and output data
X = normal(x); #get z score for input data
Y = normal(y); #get z score for input data
##Mean and stdev of y
y_mean = np.mean(y,axis=0); # mean of output y
y_std = np.std(y,ddof=1,axis=0); # standard deviation of output y
T,P,Q,B,R2X,R2Y = pls (X,Y,7); #choose 7 PCs.
X_reconstructed=T.dot(P.T); #This is for testing of re-construct of input data.
Y_reconstructed=X.dot(P.dot(B.dot(Q.T))); #This is for testing of y prediction.
## Simulation of prediction. The sample data is x, in future we need to pull
## some new data from FD
x_new=X; #to be changed to new data set.
m1,n1=y.shape;
m,n=x_new.shape;
Y_predicted=np.zeros((m,n1))
for i in range(m):
xi=x_new[i,:];
t_new=xi.dot(P); #Calculate new score.
u_new=t_new.dot(B);
Y_predicted[i,:n1]=u_new.dot(Q.T);
y_predicted=Y_predicted*y_std+y_mean;
PredictionCoefficients=P.dot(B.dot(Q.T));
解决方案
推荐阅读
- kubernetes - 什么是 minikube 附加组件?
- teechart - 使用 TChart activex 在 VBA Excel 中绘制 3D 不透明表面的奇怪行为
- discord.py - 来自上下文的参数返回空列表
- android - 签署 APK 时出现无效的密钥库格式错误
- concurrency - 接收目标列表作为输入的元谓词
- java - 是否可以更改 ViewPager Android 的默认方向?
- apache-spark - 为什么 Databricks 在其“驱动程序守护程序”中的单线程活动上会遇到瓶颈?
- alert - 如何使指标的值出现在警报消息中?
- javascript - 如何在 webpack 4/5 中配置 splitChunks 以获取单独的供应商文件?
- coffeescript - CoffeeScript 运算符优先级和函数调用