- matplotlib - numpy - pandas - scikit-learn print("Now you can write python in HTML with py-script tag!")
import matplotlib.pyplot as plt import numpy as np from sklearn.linear_model import LinearRegression x = [5,7,8,7,2,17,2,9,4,11,12,9,6] y = [99,86,87,88,111,86,103,87,94,78,77,85,86] print("Plotting specific points") fig, ax = plt.subplots() ax.scatter(x, y) fig # if we put fig as the last line, it will execute - pyscript.write('scatterplot', fig) import matplotlib.pyplot as plt import numpy as np x = np.random.randn(1000) y = np.random.randn(1000) print("Plotting 1000 random points") fig, ax = plt.subplots() ax.scatter(x, y) fig import matplotlib.pyplot as plt import numpy as np import pandas as pd from sklearn.linear_model import LinearRegression x = np.array([[1, 1], [1, 2], [2, 2], [2, 3]]) y = np.dot(x, np.array([1, 2])) + 3 reg = LinearRegression().fit(x, y) z = reg.predict(np.array([[3, 5]])) print("Linear predictive model") print(z)