1.standard Deviation of Speed of Cars
1.standard Deviation of Speed of Cars
1.standard Deviation of Speed of Cars
speed = [52,111,138,78,59,77,97,67,98,102]
x = np.std(speed)
Percentile of 7 : 57.142857142857146
Percentile of 34 : 100.0
Percentile of 2 : 28.571428571428573
import numpy as np
from scipy.stats import norm
import matplotlib.pyplot as plt
plt.plot(x, p)
title = "Fit Values: {:.2f} and {:.2f}".format(mu, std)
plt.title(title)
4. Scatter plot
import matplotlib.pyplot as plt
x =[15,57, 28, 37, 42, 17, 52, 19, 34, 11, 12, 59, 36]
y =[99, 86, 87, 88, 100, 86, 103, 87, 94, 78, 77, 85, 86]
plt.scatter(x,y,c='b')
plt.title("Scatter plot")
plt.show()
5. Polynomial regression
import numpy
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]
plt.scatter(x, y)
plt.plot(myline, mymodel(myline))
plt.show()
6. Decision tree
from sklearn.datasets import load_iris
iris = load_iris()
import matplotlib.pyplot as plt
from sklearn.tree import DecisionTreeClassifier
X = iris.data
y = iris.target
import sqlite3
conn = sqlite3.connect('Bank.db')
c = conn.cursor()
def create_table():
c.execute('CREATE TABLE IF NOT EXISTS customer_table (Number int, Name TEXT)')
print('Table created')
print()
def data_entry(number,name):
c.execute("INSERT INTO customer_table(Number, Name) VALUES(?, ?)", (number, name))
def select_query():
c.execute("SELECT * FROM customer_table ")
myresult = c.fetchall()
for x in myresult:
print(x)
create_table()
data_entry(1234, 'Anu')
data_entry(1345,'Jeya lakshmi')
data_entry(1456,'Kumari')
select_query()
c.close()
conn.close()
import sqlite3
conn = sqlite3.connect('inventory.db')
c = conn.cursor()
def create_table():
c.execute('CREATE TABLE IF NOT EXISTS stock_table (Number int, Name text, Price real)')
def select_query():
c.execute("SELECT * FROM stock_table where price >4500")
myresult = c.fetchall()
for x in myresult:
print(x)
create_table()
data_entry(1234, 'table',3450)
data_entry(1345,’chair’,4500)
data_entry(1456,'teepoy’,5000)
select_query()
c.close()
conn.close()
# connect to database
con = sqlite3.connect('college.db')
c = con.cursor()
def create_table():
c.execute('CREATE TABLE IF NOT EXISTS student (Number int, Name text, Mark int)')
print('Table created')
print()
def data_entry(number,name,mark):
c.execute("INSERT INTO student(Number, Name,Mark) VALUES(?, ?, ?)", (number, name, mark))
def select_query():
c.execute("SELECT * FROM student")
myresult = c.fetchall()
for x in myresult:
print(x)
def delete_table():
c.execute("DROP TABLE student")
print('Table dropped')
create_table()
data_entry(1234, 'Anu',67)
data_entry(1345,'Jeya lakshmi',80)
data_entry(1456,'Kumari',70)
select_query()
print()
delete_table()
select_query()
c.close()
con.close()
cur = con.cursor()
import sqlite3
conn = sqlite3.connect('inventory1.db')
c = conn.cursor()
def create_table():
c.execute('CREATE TABLE IF NOT EXISTS stock_table (Number int, Name TEXT, Price real)')
def select_query():
c.execute("SELECT * FROM stock_table ")
myresult = c.fetchall()
for x in myresult:
print(x)
def update_table():
c.execute("UPDATE stock_table SET name = 'grinder' WHERE Number =1456")
create_table()
data_entry(1234, 'chair',345)
data_entry(1345,'table',4500)
data_entry(1456,'mixie',5000)
print()
print("Before updation")
select_query()
print()
update_table()
print("After updation")
select_query()
c.close()
conn.close()