Computer Science
-
Objects & AlgorithmsComputer Science 2022. 10. 21. 20:08
Let's say we have a class such as: class student: def __init__(self): self.firstname = 'David' self.lastname = 'Joyner' DJ = student() in this code, we can say DJ is an instance, student is object object is a general class that cannot be specified, and DJ is an instance that can be specified. for the other example, we can say 'person' is object, 'David Joyner' is instance that exists only one in..
-
dataframe 에서 any() 와 any(1)의 차이점Computer Science 2022. 9. 26. 23:45
다음과 같은 데이터프레임을 생성한다고 해 보자. # let's say we have a dataframe such as: import pandas as pd import numpy as np df = pd.DataFrame({'A':[0,1,2], 'B':[1,2,3], 'C':[2,3,4]}) column = ['C'] df.loc[1,'B'] = np.nan df[column] = np.nan df 출력하면 아래와 같이 나온다. ABC 001.0NaN 11NaNNaN 223.0NaN 여기서 A와 B칼럼에 대해서 결측치(NaN)값만 추출해 보자 sols = ['A','B'] df[sols].isnull().any() any()로 할 경우 any(0)와 같기 때문에 칼럼 기준으로 결측치 여부를 판별한다 ..