From a question to a checked output
Your question.
A reviewable script.
Use the assistant to draft Python, inspect the code in the workbench, then run it against your worksheet. Bring the latest error into Review / fix when the script needs attention.
- 01
Ask with context.Name the response, predictors and the chart you need.
- 02
Inspect the draft.Check the column names, transformations and method.
- 03
Run and review.Use the returned output and errors to guide the next step.
Explore AI & Python ↗Python / exampleWorksheet context
import numpy as np
import matplotlib.pyplot as plt
x = df["Tool_Wear_um"].to_numpy()
y = df["Vibration_RMS_g"].to_numpy()
valid = np.isfinite(x) & np.isfinite(y)
x, y = x[valid], y[valid]
fig, ax = plt.subplots()
ax.scatter(x, y, s=18, alpha=0.7)
coefficients = np.polyfit(x, y, 2)
grid = np.linspace(x.min(), x.max(), 200)
ax.plot(grid, np.polyval(coefficients, grid))
ax.set(xlabel="Tool wear / µm",
ylabel="Vibration / g")
plt.show()
About this product tour