Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python code please for the commented steps Import Data [1] 1 # importing pandas and sqlite3 packages 2 import pandas as pd 3 import sqlite3

image text in transcribed

Python code please for the commented steps

Import Data [1] 1 \# importing pandas and sqlite3 packages 2 import pandas as pd 3 import sqlite3 [2] 1 from google. colab import drive 2 drive.mount( ' /content/drive') Mounted at/content/drive [3] 1 \#\# connecting the sqlite database to the notebook 2 \#\#\# change xxX to your name 3 path = '/content/drive/MyDrive/Python 6545/0livia Doody - lahman2016.sqlite' 4 conn = sqlite 3. connect ( path ) [4] 1 \#Writing the SQL query to select the teams which have played more than 150 games and are still active 2 query = '' 'select * from Teams 3 inner join Teamsfranchises on Teams.franchID == Teamsfranchises.franchID 4 where Teams.G >=150 and TeamsFranchises.active ==Y '; ' 5 6 7 \#Executing the query 8 Teams = conn.execute (query) fetchall ( ) [5] 1 \# Converting the result into a Pandas dataframe 2 \#\#\# Complete the code block below 3 \#\#\#\# create a df called 'df_raw' and from the data 'Teams" 4 5 \#\#\#\# display the first 10 rows of "df_raw" 6

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Sql All In One For Dummies 7 Books In One

Authors: Allen G Taylor ,Richard Blum

4th Edition

1394242298, 978-1394242290

More Books

Students also viewed these Databases questions

Question

=+. What advertising media and promotional tactics will you use?

Answered: 1 week ago