Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

numpy method to make polynomial model

import numpy as np
import matplotlib.pyplot as plt

x = [1,2,3,5,6,7,8,9,10,12,13,14,15,16,18,19,21,22]
y = [100,90,80,60,60,55,60,65,70,70,75,76,78,79,90,99,99,100]

#a method that lets us make a polynomial model:
model = np.poly1d(np.polyfit(x,y,3))

#Then specify how the line will display, we start 
#at position 1, and end at position 22
line = np.linspace(1, 22, 100)


plt.scatter(x, y)
plt.plot(line, model(line))
plt.show() 
Comment

PREVIOUS NEXT
Code Example
Python :: extract name of file from path python 
Python :: df empty python 
Python :: python zip() 
Python :: planets code 
Python :: FIND MISSING NUMBER IN AN ARRAY IN PYTHON 
Python :: write cell output to file jupyter colab 
Python :: plotting confusion matrix 
Python :: pathlib path of current file 
Python :: cv2 get framerete video 
Python :: delete cell in jupyter notebook 
Python :: click a button using selenium python 
Python :: df to sql mysql 
Python :: python window icon on task bar 
Python :: python square a number 
Python :: numpy array sorting 
Python :: python how to find circumference of a circle 
Python :: python run batch file 
Python :: python minigame 
Python :: find charechtar index in string python 
Python :: how to drop column where target column is null 
Python :: what is a slug 
Python :: pandas df sample 
Python :: select multiple dict 
Python :: list methods append in python 
Python :: how to make button in python 
Python :: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead 
Python :: add item to python dictionary 
Python :: how to find permutation of numbers in python 
Python :: hash table in python 
Python :: append write python 
ADD CONTENT
Topic
Content
Source link
Name
8+5 =