【发布时间】:2022-01-22 08:19:48
【问题描述】:
使用此代码,我收到此错误
"预期的二维数组,得到一维数组"
当我想将它与 Excel 表的参数一起使用时。如果有人可以帮助我,我提前感谢您。
我将所有这些库和函数用于其余工作。
import numpy as np
import pandas as pd
import sympy as sp
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
from sklearn.preprocessing import PolynomialFeatures
def R_Lineal1(x,y):
lin = LinearRegression()
lin.fit(x, y)
plt.scatter(x, y, color = 'blue')
plt.plot(x, lin.predict(x), color = 'red')
plt.title('Regresión Lineal, PWV v/s Módulo de Elasticidad')
plt.xlabel('PWV [m/s]')
plt.ylabel('ME [MPa]')
plt.grid()
plt.show()
R_Lineal1(PWV_C,ME_C)
【问题讨论】:
-
R_Lineal1(PWV_C,ME_C)我的代码结束 -
什么是 PWV_C、ME_C?
-
它们是从 excel 中提取的数字列
标签: python python-3.x jupyter-notebook jupyter jupyter-lab