Hi,
We can use pandas for reading csv file.
Using csv package we can write to another csv file.
Hi,
We can use pandas for reading csv file.
Using csv package we can write to another csv file.
Hi All,
While analising data using Google colab, it is better to use google colab as the data will be permanently saved in drive.
Hi all,
Create a csv file like given below
No,Name,Place
1,HUP,Kollam
2,Abc,Test
3,Raj,Klm
#Program 1
#Program 2
Hi all,
Use this code for NBC which removes stop words
-------------------------------------------------------------------------------
Hi,
Here one list is loaded with cubes. One element is edited intentionally.
a=[]
for i in range(10):
a.append(i**3)
a[4]=10
print(a)
a.sort(reverse=True)
print(a)
Hi all
Array can be implemented in Python using two methods
####Numpy
import numpy as np
hup=np.arange(10)
hup=np.zeros(10)
for i in range(10):
hup[i]=i**2
print(hup)
############
#Using List
a=[]
for i in range(10):
a.append(i**3)
print(a)
Hi
Use this code for Python MySql connection. You need mysql.connector for this purpose. you can install this using pip command in Python.
Also install serial using pip for serial connection.
---------------------------------------------------------------------------------------------------------------------
import mysql.connector
import time;
import serial;
from mysql.connector import Error
from mysql.connector import errorcode
ser = serial.Serial('COM3', 9600, timeout=0,parity=serial.PARITY_EVEN, rtscts=1)
try:
connection = mysql.connector.connect(host='localhost',
database='iot',
user='root',
password='')
cur = connection.cursor()
while True:
s=ser.read();
print(s);
time.sleep(1);
sql=("INSERT INTO timerecord (userid, recordtime, userrole ) VALUES (%s,%s,%s)")
val=("1",s,"1")
if s=="9":
cur.execute(sql,val)
connection.close()
except mysql.connector.Error as error :
connection.rollback() #rollback if any exception occured
print("Failed inserting record into python_users table {}".format(error))