Assiment 1
Assiment 1
3. Create following table STAFF using SQLite and then close the connection.
STAFF(sid INTEGER Primary key, sname text(20), city text(20),age INTEGER)
7. Extract name of staff, age and city name that are from Surat.
8. Using cursor, write Python code to display all staff from the table using fetchall() method.
9. Display first three records from the staff table using fetchone() method.
2. Write a Python code to create data file (CSV) file using CSV module:
1. Use open() method of the CSV module to create and open Staff.csv file in “w” mode. The
Staff.csv fill will contain (sid, sname, city, age) attributes.
2. Write a python code to store five records using writerow() method in CSV file. Make sure to add
first row containing the title of the attributes.
3. Write a python code to open the csv file in ‘r’ mode. (Read mode). Using reader() method
to display all records available from the data file using for loop.
3. Problem: Create Text file and store records in the text file using pipe ( | ) as separator. Tasks:
2. Insert five records consists of two attributes ( staff_id and Staff_name) using write() method. Close
the file at end.
3. Open the file in Read (‘r’) mode and read the file using read()method. Display the content of the
file using read() method. Close the file.
4. Open the file in Read (‘r’) mode and read the file using readline()method. Display the content
of the file using readline() method. Close the file.
4. Use of Dataframe and creating Dataframe from List, Dictionary and CSV file. (Use Pandas
library)
1. Create a list consists of ten names. Use the list to store the list elements in DataFrame.
Display the created dataframe.
2. Create DataFrame from Dictionary which is consists of lists. Create following dictionary
consists of three keys and each of them contain corresponding list of values.