# -*- coding: utf-8 -*-
"""
Created on Mon May 15 13:41:14 2023

@author: black
"""

import pandas as pd
titanic = pd.read_csv("C:\\Users\\black\\Desktop\\ch15\\titanic.csv")

'''
print(titanic)
print(titanic["Age"])
print(titanic["Age"].max())

print(titanic.describe())
print(titanic.dtypes)
'''
ages=titanic["Age"]
print(ages.head())
print(ages.shape) #크기

print(titanic[["Name", "Age", "Sex"]])


below_20 = titanic[titanic["Age"] < 20]
print(below_20.head(10))

print(titanic[titanic["Pclass"].isin([1, 2])])

print(titanic.loc[titanic["Age"] < 20, "Name"])
print(titanic.loc[titanic["Age"] < 20, ["Name", "Age"]])

print(titanic.iloc[20:23, 5:7])

print(titanic.sort_values(by="Age").head())

print(titanic.sort_values(by=['Pclass', 'Age'], ascending=False).head())

x = titanic.sort_values(by=['Pclass', 'Age'], ascending=False)
print(x[["Name", "Age", "Sex"]])
'''
'''