Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

# importing data # DON'T MODIFY THIS CELL from pandasql import sqldf import pandas as pd pysqldf = lambda q: sqldf(q, globals()) titanic = pd.read_csv('https://raw.githubusercontent.com/mwaskom/seaborn-data/master/titanic.csv')

image text in transcribedimage text in transcribed

# importing data # DON'T MODIFY THIS CELL

from pandasql import sqldf import pandas as pd pysqldf = lambda q: sqldf(q, globals()) titanic = pd.read_csv('https://raw.githubusercontent.com/mwaskom/seaborn-data/master/titanic.csv') titanic.head()

was the largest ship afloat at the time it was made. Unfortunately, the ship sank in its maiden voyage. In the following cells, you will see data about the passengers in Titanic. You will use SQL and Python techniques to parsel process data about those passengers. 1 # importing data # DON'T MODIFY THIS CELL from pandasql import sqldf import pandas as pd pysqldf = lambda q: sqldf(q, globals()) titanic = pd. read_csv('https://raw.githubusercontent.com/mwaskom/seaborn-data/master/ti titanic.head() survived pclass sex age sibsp parch fare embarked class who adult_male deck 0 0 3 male 22.0 1 0 7.2500 S Third man True NaN 1 1 1 female 38.0 1 0 71.2833 First woman False 2 1 3 female 26.0 0 0 7.9250 S Third woman False NaN 3 1 1 female 35.0 1 0 53.1000 S First woman False C 4 0 3 male 35.0 0 0 8.0500 S Third man True NaN Unless otherwise mentioned, you are free to use either Python or SQL or both as you see fit. # Write your name after the '#' in the next line. # Q1 [5 points]: Show only the first 20 samples of the dataset? Q2 [10 points]: Order the dataset by fare in descending order. Show only the first 15 rows. # guideline: must use SQL, along with Python Q3 [5 points]: How many passengers' records can be found in this dataset? adult_male deck embark_town alive alone True NaN Southampton no False False False NaN Cherbourg yes False Southampton yes True Southampton yes False False True NaN Southampton no True

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

Step: 3

blur-text-image

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

Database Management With Website Development Applications

Authors: Greg Riccardi

1st Edition

0201743876, 978-0201743876

More Books

Students also viewed these Databases questions