입력값
import pandas as pd
data_list = []
data = {}
data['name'] = '이서연'
data['gender'] = 'F'
data['age'] = 31
data_list.append(data)
data = {}
data['name'] = '김민준'
data['gender'] = 'M'
data['age'] = 38
data_list.append(data)
data = {}
data['name'] = '박지우'
data['gender'] = 'M'
data['age'] = 45
data_list.append(data)
data = {}
data['name'] = '윤지민'
data['gender'] = 'F'
data['age'] = 23
data_list.append(data)
data = {}
data['name'] = '송유진'
data['gender'] = 'F'
data['age'] = 23
data_list.append(data)
df = pd.DataFrame(data_list)
정렬 - 순차
df = df.sort_values(["age"], ascending=[True])
정렬 - 역순
df = df.sort_values(["age"], ascending=[False])
질의query 예
df = df.query("gender == 'F' and age > 30")
참고할 자료