PYTHON PANDAS - SORTING & ORDERING & CANCATENATING
SORTING df = pd.DataFrame({'Employee ID':[111, 222, 333, 444], 'Employee Name':['Chanel', 'Steve', 'Mitch', 'Bird'], 'Salary [$/h]':[35, 29, 38, 20], 'Years of Experience':[3, 4 ,9, 1]}) df # 경력을 오름차순으로 정렬 df.sort_values('Years of Experience') # 내림차순으로 정렬 df.sort_values('Years of Experience', ascending= False) # 이름과 경력으로 정렬하되, # 이름은 내림차순, 경력은 오름차순으로 정렬 df.sort_values( ['Employee Name','Years of ..
PYTHON PANDAS - PANDAS OPERATIONS & APPLYING FUNCTION
PANDAS OPERATIONS df = pd.DataFrame({'Employee ID':[111, 222, 333, 444], 'Employee Name':['Chanel', 'Steve', 'Mitch', 'Bird'], 'Salary [$/h]':[35, 29, 38, 20], 'Years of Experience':[3, 4 ,9, 1]}) df # 경력이 3년 이상인 사람의 데이터를 가져오시오 df['Years of Experience'] >= 3 # 경력이 3년 이상인 사람의, 이름과 시급 정보를 가져오시오 df.loc[ df['Years of Experience'] >= 3 , [ 'Employee Name' , 'Salary [$/h]' ] ] # 경력이 3년 이상이고, 8년 이하인 사람..
PYTHON PANDAS - NaN
NaN import pandas as pd # We create a list of Python dictionaries items2 = [{'bikes': 20, 'pants': 30, 'watches': 35, 'shirts': 15, 'shoes':8, 'suits':45}, {'watches': 10, 'glasses': 50, 'bikes': 15, 'pants':5, 'shirts': 2, 'shoes':5, 'suits':7}, {'bikes': 20, 'pants': 30, 'watches': 35, 'glasses': 4, 'shoes':10}] df = pd.DataFrame(data= items2, index= ['store 1','store 2', 'store 3']) NaN 이 얼마나..