Skip to content

Commit f4005b4

Browse files
committed
i am adding all the files
1 parent 4c25a50 commit f4005b4

9 files changed

+955
-0
lines changed

apple_stocks.csv

Lines changed: 754 additions & 0 deletions
Large diffs are not rendered by default.

favourite.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# import csv
2+
3+
# i = 0
4+
# # titles = set()
5+
# title = {}
6+
7+
# with open("apple_stocks.csv","r") as file:
8+
# reader = csv.DictReader(file)
9+
# for row in reader:
10+
# row = row["Date"].strip()
11+
# if row not in title:
12+
# title.update(row)
13+
# else:
14+
# title[title] += 1
15+
16+
# # the below code line is used to sort the number
17+
# for titles in sorted(title):
18+
# print(titles)
19+
20+
import csv
21+
22+
titles = {}
23+
24+
with open("top_movies.csv","r") as file:
25+
reader = csv.DictReader(file)
26+
for row in reader:
27+
row = row["movie"].strip()
28+
if row not in titles:
29+
dictq = {f"{row}":0}
30+
titles.update(dictq)
31+
titles[row] += 1
32+
33+
def f(title):
34+
return titles[title]
35+
36+
# the below one are the lambda functions you can use this instead of the traditional functions
37+
for title in sorted(titles,key=lambda title:titles[title],reverse=True):
38+
print(title,titles[title])

favourite1.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import csv
2+
import sqlite3
3+
4+
# way to create a empty file
5+
open("shows.db","w").close() # -> opening and closing and file
6+
7+
db = sqlite3.connect("shows.db") # connecting sqlite3 to the database
8+
9+
c = db.cursor()
10+
11+
# db.execute("CREATE TABLE IF NOT EXISTS shows (id INTEGER,title TEXT,PRIMARY KEY(id))")
12+
# db.execute("CREATE TABLE IF NOT EXISTS genres (show_id INTEGER,genre TEXT,FOREIGN KEY(show_id) REFERENCES shows(id)")
13+
# db.execute("DROP TABLE shows")
14+
# db.execute("DROP TABLE genres")
15+
16+
c.execute("CREATE TABLE shows (id INTEGER ,title STRING,PRIMARY KEY(id))")
17+
c.execute("CREATE TABLE genres (id INTEGER,genre TEXT,FOREIGN KEY(id) REFERENCES shows(id))")
18+
19+
with open("top_movies.csv","r") as file:
20+
reader = csv.DictReader(file)
21+
for row in reader:
22+
title = row["movie"].strip().upper()
23+
24+
c.executemany("INSERT INTO shows (title) VALUES(?)",[title,])

hello.db

Whitespace-only changes.

hello.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import sqlite3
2+
from sqlite3 import Error
3+
def sql_connection():
4+
try:
5+
conn = sqlite3.connect('shows.db')
6+
return conn
7+
except Error:
8+
print(Error)
9+
10+
def sql_table(conn, rows):
11+
cursorObj = conn.cursor()
12+
# Create the table
13+
cursorObj.execute("CREATE TABLE shows (id INTEGER ,title CHAR(30),PRIMARY KEY(id))")
14+
15+
sqlite_insert_query = """INSERT INTO shows
16+
(id, title)
17+
VALUES (?, ?);"""
18+
19+
cursorObj.executemany(sqlite_insert_query, rows)
20+
conn.commit()
21+
print("Number of records after inserting rows:")
22+
cursor = cursorObj.execute('select * from shows;')
23+
print(len(cursor.fetchall()))
24+
25+
# Insert records
26+
rows = []
27+
28+
import csv
29+
30+
with open("top_movies.csv","r") as file:
31+
reader = csv.DictReader(file)
32+
for row in reader:
33+
title = row["movie"].strip().upper()
34+
number = row["num"].strip()
35+
rows.append((int(number),title))
36+
37+
sqllite_conn = sql_connection()
38+
sql_table(sqllite_conn, rows)
39+
40+
if (sqllite_conn):
41+
sqllite_conn.close()
42+
print("\nThe SQLite connection is closed.")

kray.py

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import sqlite3
2+
from sqlite3 import Error
3+
4+
def sql_connection():
5+
try:
6+
conn = sqlite3.connect('shows.db')
7+
return conn
8+
except Error:
9+
print(Error)
10+
11+
def sql_table(conn, rows,genres):
12+
cursorObj = conn.cursor()
13+
# Create the table
14+
cursorObj.execute("CREATE TABLE shows (id INTEGER ,title CHAR(30),PRIMARY KEY(id))")
15+
cursorObj.execute("CREATE TABLE genres (id INTEGER,genre TEXT,FOREIGN KEY(id) REFERENCES shows(id))")
16+
17+
sqlite_insert_query = """INSERT INTO shows
18+
(id, title)
19+
VALUES (?, ?);"""
20+
21+
sqlite_insert_genr_query = """INSERT INTO genres
22+
(id, genre)
23+
VALUES (?, ?);"""
24+
25+
cursorObj.executemany(sqlite_insert_query, rows)
26+
cursorObj.executemany(sqlite_insert_genr_query, genr)
27+
conn.commit()
28+
print("Number of records after inserting rows:")
29+
cursor = cursorObj.execute('select * from shows;')
30+
print(len(cursor.fetchall()))
31+
32+
# Insert records
33+
rows = []
34+
genr = []
35+
36+
import csv
37+
38+
with open("top_movies.csv","r") as file:
39+
reader = csv.DictReader(file)
40+
counter = 1
41+
for row in reader:
42+
title = row["movie"].strip().upper()
43+
number = row["num"].strip()
44+
rows.append((int(number),title))
45+
for genre in row["genres"].split(" "):
46+
genr.append((counter,genre))
47+
counter+=1
48+
49+
sqllite_conn = sql_connection()
50+
sql_table(sqllite_conn, rows,genr)
51+
52+
if (sqllite_conn):
53+
sqllite_conn.close()
54+
print("\nThe SQLite connection is closed.")

shows.db

12 KB
Binary file not shown.

top_movies.csv

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
date,movie,bool,average_rating,average_votes,genres,num
2+
1995-10-20,Dilwale Dulhania Le Jayenge,FALSE,8.7,3011,comedy friends,1
3+
1994-09-23,The Shawshank Redemption,FALSE,8.7,19210,mental health,2
4+
2020-07-31,Gabriel's Inferno Part II,FALSE,8.7,1278,emperor manufacturer,3
5+
1972-03-14,The Godfather,FALSE,8.7,14499,gangsters fight,4
6+
2020-11-19,Gabriel's Inferno Part III,FALSE,8.7,839,fightclub building,5
7+
2020-05-29,Gabriel's Inferno,FALSE,8.6,2072,ruling spaceship,6
8+
1993-11-30,Schindler's List,FALSE,8.6,11540,love romance,7
9+
1974-12-20,The Godfather: Part II,FALSE,8.6,8672,universe voyager,8
10+
1974-12-20,The Godfather: Part II,FALSE,8.6,8672,killing ganleadership,9
11+
2016-08-26,Your Name.,FALSE,8.6,7622,carchases fightscenes,10
12+
2001-07-20,Spirited Away,FALSE,8.5,11520,spirits adventure,11
13+
2019-05-30,Parasite,FALSE,8.5,11678,heaven gods,12
14+
2019-12-20,My Hero Academia: Heroes Rising,FALSE,8.5,749,heros villians,13
15+
2019-06-15,Rascal Does Not Dream of a Dreaming Girl,FALSE,8.5,281,cowards fools,14
16+
1999-12-10,The Green Mile,FALSE,8.5,12463,running racing,15
17+
2020-10-26,Wolfwalkers,FALSE,8.5,492,wolfs adventrues,16
18+
1957-04-10,12 Angry Men,FALSE,8.5,5669,pschology beatuy,17
19+
2019-11-01,Dedicated to my ex,FALSE,8.5,398,action drama,18
20+
2020-11-27,Life in a Year,FALSE,8.5,695,animation comedy,19
21+
1994-09-10,Pulp Fiction,FALSE,8.5,21360,crime intelligence,20
22+
2000-09-15,A Dog's Will,FALSE,8.5,786,passion wisdom,21

toprated_movies.csv

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
page,results » adult,results » backdrop_path,results » genre_ids » 1,results » genre_ids » 2,results » genre_ids » 3,results » genre_ids » 4,results » genre_ids » 5,results » id,results » original_language,results » original_title,results » overview,results » popularity,results » poster_path,results » release_date,results » title,results » video,results » vote_average,results » vote_count,total_pages,total_results
2+
1,FALSE,/gNBCvtYyGPbjPCT1k3MvJuNuXR6.jpg,35,18,10749,,,19404,hi,दिलवाले दुल्हनिया ले जायेंगे,"Raj is a rich, carefree, happy-go-lucky second generation NRI. Simran is the daughter of Chaudhary Baldev Singh, who in spite of being an NRI is very strict about adherence to Indian values. Simran has left for India to be married to her childhood fiancé. Raj leaves for India with a mission at his hands, to claim his lady love under the noses of her whole family. Thus begins a saga.",17.849,/2CAL2433ZeIihfX1Hb2139CX0pW.jpg,1995-10-20,Dilwale Dulhania Le Jayenge,FALSE,8.7,3011,445,8884
3+
,FALSE,/iNh3BivHyg5sQRPP1KOkzguEX0H.jpg,18,80,,,,278,en,The Shawshank Redemption,"Framed in the 1940s for the double murder of his wife and her lover, upstanding banker Andy Dufresne begins a new life at the Shawshank prison, where he puts his accounting skills to work for an amoral warden. During his long stretch in prison, Dufresne comes to be admired by the other inmates -- including an older prisoner named Red -- for his integrity and unquenchable sense of hope.",50.397,/q6y0Go1tsGEsmtFryDOJo3dEmqu.jpg,1994-09-23,The Shawshank Redemption,FALSE,8.7,19210,,
4+
,FALSE,/jtAI6OJIWLWiRItNSZoWjrsUtmi.jpg,10749,,,,,724089,en,Gabriel's Inferno Part II,"Professor Gabriel Emerson finally learns the truth about Julia Mitchell's identity, but his realization comes a moment too late. Julia is done waiting for the well-respected Dante specialist to remember her and wants nothing more to do with him. Can Gabriel win back her heart before she finds love in another's arms?",6.571,/x5o8cLZfEXMoZczTYWLrUo1P7UJ.jpg,2020-07-31,Gabriel's Inferno Part II,FALSE,8.7,1278,,
5+
,FALSE,/rSPw7tgCH9c6NqICZef4kZjFOQ5.jpg,18,80,,,,238,en,The Godfather,"Spanning the years 1945 to 1955, a chronicle of the fictional Italian-American Corleone crime family. When organized crime family patriarch, Vito Corleone barely survives an attempt on his life, his youngest son, Michael steps in to take care of the would-be killers, launching a campaign of bloody revenge.",45.439,/3bhkrj58Vtu7enYsRolD1fZdja1.jpg,1972-03-14,The Godfather,FALSE,8.7,14499,,
6+
,FALSE,/fQq1FWp1rC89xDrRMuyFJdFUdMd.jpg,10749,35,,,,761053,en,Gabriel's Inferno Part III,The final part of the film adaption of the erotic romance novel Gabriel's Inferno written by an anonymous Canadian author under the pen name Sylvain Reynard.,17.254,/fYtHxTxlhzD4QWfEbrC1rypysSD.jpg,2020-11-19,Gabriel's Inferno Part III,FALSE,8.7,839,,
7+
,FALSE,/w2uGvCpMtvRqZg6waC1hvLyZoJa.jpg,10749,,,,,696374,en,Gabriel's Inferno,"An intriguing and sinful exploration of seduction, forbidden love, and redemption, Gabriel's Inferno is a captivating and wildly passionate tale of one man's escape from his own personal hell as he tries to earn the impossible--forgiveness and love.",8.137,/oyG9TL7FcRP4EZ9Vid6uKzwdndz.jpg,2020-05-29,Gabriel's Inferno,FALSE,8.6,2072,,
8+
,FALSE,/loRmRzQXZeqG78TqZuyvSlEQfZb.jpg,18,36,10752,,,424,en,Schindler's List,The true story of how businessman Oskar Schindler saved over a thousand Jewish lives from the Nazis while they worked as slaves in his factory during World War II.,26.863,/sF1U4EUQS8YHUYjNl3pMGNIQyr0.jpg,1993-11-30,Schindler's List,FALSE,8.6,11540,,
9+
,FALSE,/poec6RqOKY9iSiIUmfyfPfiLtvB.jpg,18,80,,,,240,en,The Godfather: Part II,"In the continuing saga of the Corleone crime family, a young Vito Corleone grows up in Sicily and in 1910s New York. In the 1950s, Michael Corleone attempts to expand the family business into Las Vegas, Hollywood and Cuba.",30.918,/hek3koDUyRQk7FIhPXsa6mT2Zc3.jpg,1974-12-20,The Godfather: Part II,FALSE,8.6,8672,,
10+
,FALSE,/dIWwZW7dJJtqC6CgWzYkNVKIUm8.jpg,10749,16,18,,,372058,ja,君の名は。,"High schoolers Mitsuha and Taki are complete strangers living separate lives. But one night, they suddenly switch places. Mitsuha wakes up in Taki’s body, and he in hers. This bizarre occurrence continues to happen randomly, and the two must adjust their lives around each other.",119.671,/q719jXXEzOoYaps6babgKnONONX.jpg,2016-08-26,Your Name.,FALSE,8.6,7622,,
11+
,FALSE,/Ab8mkHmkYADjU7wQiOkia9BzGvS.jpg,16,10751,14,,,129,ja,千と千尋の神隠し,"A young girl, Chihiro, becomes trapped in a strange new world of spirits. When her parents undergo a mysterious transformation, she must call upon the courage she never knew she had to free her family.",75.456,/39wmItIWsg5sZMyRUHLkWBcuVCM.jpg,2001-07-20,Spirited Away,FALSE,8.5,11520,,
12+
,FALSE,/TU9NIjwzjoKPwQHoHshkFcQUCG.jpg,35,53,18,,,496243,ko,기생충,"All unemployed, Ki-taek's family takes peculiar interest in the wealthy and glamorous Parks for their livelihood until they get entangled in an unexpected incident.",105.463,/7IiTTgloJzvGI1TAYymCfbfl3vT.jpg,2019-05-30,Parasite,FALSE,8.5,11678,,
13+
,FALSE,/9guoVF7zayiiUq5ulKQpt375VIy.jpg,16,28,14,12,,592350,ja,僕のヒーローアカデミア THE MOVIE ヒーローズ:ライジング,"Class 1-A visits Nabu Island where they finally get to do some real hero work. The place is so peaceful that it's more like a vacation … until they're attacked by a villain with an unfathomable Quirk! His power is eerily familiar, and it looks like Shigaraki had a hand in the plan. But with All Might retired and citizens' lives on the line, there's no time for questions. Deku and his friends are the next generation of heroes, and they're the island's only hope.",353.496,/zGVbrulkupqpbwgiNedkJPyQum4.jpg,2019-12-20,My Hero Academia: Heroes Rising,FALSE,8.5,749,,
14+
,FALSE,/hQQTE285UQB1lLY1XiioQ77LYnC.jpg,16,35,10749,18,14,572154,ja,青春ブタ野郎はゆめみる少女の夢を見ない,"In Fujisawa, Sakuta Azusagawa is in his second year of high school. Blissful days with his girlfriend and upperclassman, Mai Sakurajima, are interrupted by the appearance of his first crush, Shoko Makinohara.",143.77,/7Ai8vNEv4zEveh12JViGikoVPVV.jpg,2019-06-15,Rascal Does Not Dream of a Dreaming Girl,FALSE,8.5,281,,
15+
,FALSE,/5Nz25DPXfQaSpDgce42Y3kFg9G4.jpg,14,18,80,,,497,en,The Green Mile,"A supernatural tale set on death row in a Southern prison, where gentle giant John Coffey possesses the mysterious power to heal people's ailments. When the cell block's head guard, Paul Edgecomb, recognizes Coffey's miraculous gift, he tries desperately to help stave off the condemned man's execution.",60.734,/velWPhVMQeQKcxggNEU8YmIo52R.jpg,1999-12-10,The Green Mile,FALSE,8.5,12463,,
16+
,FALSE,/yHtB4KHNigx3ZoxDvQbW2SOXGfq.jpg,16,10751,12,14,,441130,en,Wolfwalkers,"In a time of superstition and magic, when wolves are seen as demonic and nature an evil to be tamed, a young apprentice hunter comes to Ireland with her father to wipe out the last pack. But when she saves a wild native girl, their friendship leads her to discover the world of the Wolfwalkers and transform her into the very thing her father is tasked to destroy.",22.818,/uRkDrsKwCCZC9zdHZs2CFTt1ATZ.jpg,2020-10-26,Wolfwalkers,FALSE,8.5,492,,
17+
,FALSE,/qqHQsStV6exghCM7zbObuYBiYxw.jpg,18,,,,,389,en,12 Angry Men,"The defense and the prosecution have rested and the jury is filing into the jury room to decide if a young Spanish-American is guilty or innocent of murdering his father. What begins as an open and shut case soon becomes a mini-drama of each of the jurors' prejudices and preconceptions about the trial, the accused, and each other.",22.059,/7sf9CgJz30aXDvrg7DYYUQ2U91T.jpg,1957-04-10,12 Angry Men,FALSE,8.5,5669,,
18+
,FALSE,/1fOsyhVz5qyX2rl1qqX6KImVhTx.jpg,18,35,,,,644479,es,Dedicada a mi ex,"The film tells the story of Ariel, a 21-year-old who decides to form a rock band to compete for a prize of ten thousand dollars in a musical band contest, this as a last option when trying to get money to save their relationship and reunite with his ex-girlfriend, which breaks due to the trip she must make to Finland for an internship. Ariel with her friend Ortega, decides to make a casting to find the other members of the band, although they do not know nothing about music, thus forming a band with members that have diverse and opposite personalities.",21.783,/riAooJrFvVhotyaOgoI0WR7okSe.jpg,2019-11-01,Dedicated to my ex,FALSE,8.5,398,,
19+
,FALSE,/88J6waYVTta8Qz3iX3qUeWNA5d5.jpg,18,10749,,,,447362,en,Life in a Year,"A 17 year old finds out that his girlfriend is dying, so he sets out to give her an entire life, in the last year she has left.",93.567,/bP7u19opmHXYeTCUwGjlLldmUMc.jpg,2020-11-27,Life in a Year,FALSE,8.5,695,,
20+
,FALSE,/suaEOtk1N1sgg2MTM7oZd2cfVp3.jpg,53,80,,,,680,en,Pulp Fiction,"A burger-loving hit man, his philosophical partner, a drug-addled gangster's moll and a washed-up boxer converge in this sprawling, comedic crime caper. Their adventures unfurl in three stories that ingeniously trip back and forth in time.",48.649,/d5iIlFn5s0ImszYzBPb8JPIfbXD.jpg,1994-09-10,Pulp Fiction,FALSE,8.5,21360,,
21+
,FALSE,/alQqTpmEkxSLgajfEYTsTH6nAKB.jpg,12,35,,,,40096,pt,O Auto da Compadecida,"The lively Jack the Cricket and the sly Chicó are poor guys living in the hinterland who cheat a bunch of people in a small in Northeastern Brazil. When they die, they have to be judged by Christ, the Devil and the Virgin Mary before they are admitted to paradise.",7.875,/m8eFedsS7vQCZCS8WGp5n1bVD0q.jpg,2000-09-15,A Dog's Will,FALSE,8.5,786,,

0 commit comments

Comments
 (0)