inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

공공데이터로 파이썬 데이터 분석 시작하기

[2/15] 데이터 로드하고 결측치 보기

괄호 사용

322

능함가

작성한 질문수 18

1

괄호 사용이 헷갈려 질문드립니다.
 
어떤경우에는 괄호 사용하면 오류메시지가 뜨고
어떤 경우에는 과호가 없으면 오류메시지가 뜨고
ex) df.shape / df.head()
 
이렇듯 괄호사용의 기준에 대해서 알려주시면 감사하겠습니다.
 

괄호 numpy pandas python

답변 1

1

박조은

안녕하세요.

판다스 내부에 구현된 기능들은 Attributes 와 Method 가 있습니다.

괄호가 없는 것은 Attributes 이고 괄호가 있는 것은 Method 로 구현이 되어 있어요.

이건 오픈소스 개발자들이 굳이 옵션이 없이 값을 보고자 하는 것들은 Attributes 로 개발을 해두었고, 하지만 Attributes 중에도 괄호가 들어가는 것들이 있습니다.

head(), tail() 처럼 갯수를 지정한다든지 sort_values()에서 조건을 지정한다든지 조건이 필요한 것들은 Method로 구현을 해두었습니다.

 

그래서 아쉽게도 이 부분은 문서를 참고해서 사용하는 것을 추천합니다. 공식문서의 링크를 참고해 보세요!

[Series — pandas 1.4.3 documentation](https://pandas.pydata.org/docs/reference/series.html)

[DataFrame — pandas 1.4.3 documentation](https://pandas.pydata.org/docs/reference/frame.html)

 

다음은 시리즈의 Attributes 입니다.

Attributes

Axes

Series.index

The index (axis labels) of the Series.

Series.array

The ExtensionArray of the data backing this Series or Index.

Series.values

Return Series as ndarray or ndarray-like depending on the dtype.

Series.dtype

Return the dtype object of the underlying data.

Series.shape

Return a tuple of the shape of the underlying data.

Series.nbytes

Return the number of bytes in the underlying data.

Series.ndim

Number of dimensions of the underlying data, by definition 1.

Series.size

Return the number of elements in the underlying data.

Series.T

Return the transpose, which is by definition self.

Series.memory_usage([index, deep])

Return the memory usage of the Series.

Series.hasnans

Return True if there are any NaNs.

Series.empty

Indicator whether Series/DataFrame is empty.

Series.dtypes

Return the dtype object of the underlying data.

Series.name

Return the name of the Series.

Series.flags

Get the properties associated with this pandas object.

Series.set_flags(*[, copy, ...])

Return a new object with updated flags.

 

다음은 데이터프레임의 Attributes 입니다. 하지만 Attributes 중에도 괄호가 있는 것도 있으니 문서를 참고해 주세요!

Attributes and underlying data

Axes

DataFrame.index

The index (row labels) of the DataFrame.

DataFrame.columns

The column labels of the DataFrame.

DataFrame.dtypes

Return the dtypes in the DataFrame.

DataFrame.info([verbose, buf, max_cols, ...])

Print a concise summary of a DataFrame.

DataFrame.select_dtypes([include, exclude])

Return a subset of the DataFrame's columns based on the column dtypes.

DataFrame.values

Return a Numpy representation of the DataFrame.

DataFrame.axes

Return a list representing the axes of the DataFrame.

DataFrame.ndim

Return an int representing the number of axes / array dimensions.

DataFrame.size

Return an int representing the number of elements in this object.

DataFrame.shape

Return a tuple representing the dimensionality of the DataFrame.

DataFrame.memory_usage([index, deep])

Return the memory usage of each column in bytes.

DataFrame.empty

Indicator whether Series/DataFrame is empty.

DataFrame.set_flags(*[, copy, ...])

Return a new object with updated flags.

 

 

 

 

 

 

패키지 설치 에러 ydata-profiling

0

122

2

자세한 설명 부탁드려요 ㅜ

0

179

2

seaborn 라이브러리 호출하였으나 그래프가 안 그려져요

0

291

2

value_counts와 count 차이

0

347

2

안녕하세요 데이터 최신과 관련해서 문의드립니다.

0

206

3

scatterplot질문

0

123

1

강의 화면이 안나옵니다

0

166

2

4분12초 2013년부터 데이터가 없으면 어떻게하나요?..

0

190

2

에러 메시지

1

305

2

그래프 색이 동일하게 나옵니다.

0

312

2

시각화 라이브러리 비교

0

388

2

주피터 노트북 설치

0

391

1

2. 상가 기술통계 아웃풋 자료에서 오류가 납니다

0

228

1

14. distplot g = sns.FacetGrid(df_last, row="지역명", height=1.7, aspect=4) g.map(sns.distplot, "평당분양가격", hist=False, rug=True); 오류

0

180

1

group by agg function failed 에러

0

690

2

빈도수가 1000개 이상인 데이터를 따로 담을 때 코드 질문 있습니다.

0

289

2

주피터 노트북 실행 했는데 앞에 *가 생기고 결과가 나오지 않아요

0

366

3

get_string함수에서 문자 'nan'

0

202

1

seaborn X축 시작 지점 조정 질의의 건

0

217

1

14강 distplot 질의

0

290

1

nbextension 설치 및 셋팅 후 적용이 안되는 이슈

0

483

1

corr = df.corr() 입력시 오류

1

375

1

keyword grid_b is not recognized

0

338

1

%ls data 매직커맨드 사용시 한글 깨짐

0

296

1