.뒤에 명령을 실행할 때 () 유무 차이
240
작성한 질문수 18
df_last 같은 변수 뒤에 .을 붙이고 copy() 같은 명령을 실행할 때 ()를 붙이는 기준이 따로 있나요?
copy같은 경우는 ()를 붙일때와 안 붙일때 나오는 값의 형태가 다른 거 같은데 어떤 차이가 있는 건가요?
답변 1
1
안녕하세요.
좋은질문을 해주셨네요.
소괄호가 붙고 안 붙고의 차이는 Attributes 와 Methods 의 차이입니다.
아래 판다스 DataFrame의 Attributes 와 Methods 목록을 가져왔는데요.
가장 큰 차이는 옵션이 있는지 없는지에 대한 차이가 될거 같아요.
예를 들어 shape는 반환값이 (행, 열) 튜플로 반환이 되는데 이건 옵션이 따로 있지 않아요.
head()는 메소드인데 n 값에 대한 옵션이 있어요.
아래는 DataFrame 의 API 목록인데 Series 를 사용하더라도 같은 방법으로 대부분 사용하실 수 있습니다.
아래 링크를 참고해 보세요.
[pandas.DataFrame — pandas 1.0.3 documentation](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.html)
Attributes
|
Transpose index and columns. |
|
|
Access a single value for a row/column label pair. |
|
|
Dictionary of global attributes on this object. |
|
|
Return a list representing the axes of the DataFrame. |
|
|
The column labels of the DataFrame. |
|
|
Return the dtypes in the DataFrame. |
|
|
Indicator whether DataFrame is empty. |
|
|
Access a single value for a row/column pair by integer position. |
|
|
Purely integer-location based indexing for selection by position. |
|
|
The index (row labels) of the DataFrame. |
|
|
Access a group of rows and columns by label(s) or a boolean array. |
|
|
Return an int representing the number of axes / array dimensions. |
|
|
Return a tuple representing the dimensionality of the DataFrame. |
|
|
Return an int representing the number of elements in this object. |
|
|
Returns a Styler object. |
|
|
Return a Numpy representation of the DataFrame. |
Methods
|
|
Return a Series/DataFrame with absolute numeric value of each element. |
|
|
Get Addition of dataframe and other, element-wise (binary operator add). |
|
|
Prefix labels with string prefix. |
|
|
Suffix labels with string suffix. |
|
|
Aggregate using one or more operations over the specified axis. |
|
|
Aggregate using one or more operations over the specified axis. |
|
|
Align two objects on their axes with the specified join method. |
|
|
Return whether all elements are True, potentially over an axis. |
|
|
Return whether any element is True, potentially over an axis. |
|
|
Append rows of other to the end of caller, returning a new object. |
|
|
Apply a function along an axis of the DataFrame. |
|
|
Apply a function to a Dataframe elementwise. |
|
|
Convert TimeSeries to specified frequency. |
|
|
Return the last row(s) without any NaNs before where. |
|
|
Assign new columns to a DataFrame. |
|
|
Cast a pandas object to a specified dtype |
|
|
Select values at particular time of day (e.g. |
|
|
Select values between particular times of the day (e.g., 9:00-9:30 AM). |
|
|
Synonym for |
|
|
Return the bool of a single element PandasObject. |
|
|
Make a box plot from DataFrame columns. |
|
|
Trim values at input threshold(s). |
|
|
Perform column-wise combine with another DataFrame. |
|
|
Update null elements with value in the same location in other. |
|
|
Convert columns to best possible dtypes using dtypes supporting |
|
|
Make a copy of this object’s indices and data. |
|
|
Compute pairwise correlation of columns, excluding NA/null values. |
|
|
Compute pairwise correlation. |
|
|
Count non-NA cells for each column or row. |
|
|
Compute pairwise covariance of columns, excluding NA/null values. |
|
|
Return cumulative maximum over a DataFrame or Series axis. |
|
|
Return cumulative minimum over a DataFrame or Series axis. |
|
|
Return cumulative product over a DataFrame or Series axis. |
|
|
Return cumulative sum over a DataFrame or Series axis. |
|
|
Generate descriptive statistics. |
|
|
First discrete difference of element. |
|
|
Get Floating division of dataframe and other, element-wise (binary operator truediv). |
|
|
Get Floating division of dataframe and other, element-wise (binary operator truediv). |
|
|
Compute the matrix multiplication between the DataFrame and other. |
|
|
Drop specified labels from rows or columns. |
|
|
Return DataFrame with duplicate rows removed. |
|
|
Return DataFrame with requested index / column level(s) removed. |
|
|
Remove missing values. |
|
|
Return boolean Series denoting duplicate rows. |
|
|
Get Equal to of dataframe and other, element-wise (binary operator eq). |
|
|
Test whether two objects contain the same elements. |
|
|
Evaluate a string describing operations on DataFrame columns. |
|
|
Provide exponential weighted functions. |
패키지 설치 에러 ydata-profiling
0
121
2
자세한 설명 부탁드려요 ㅜ
0
177
2
seaborn 라이브러리 호출하였으나 그래프가 안 그려져요
0
288
2
value_counts와 count 차이
0
343
2
안녕하세요 데이터 최신과 관련해서 문의드립니다.
0
205
3
scatterplot질문
0
122
1
강의 화면이 안나옵니다
0
164
2
4분12초 2013년부터 데이터가 없으면 어떻게하나요?..
0
188
2
에러 메시지
1
303
2
그래프 색이 동일하게 나옵니다.
0
309
2
시각화 라이브러리 비교
0
384
2
주피터 노트북 설치
0
390
1
2. 상가 기술통계 아웃풋 자료에서 오류가 납니다
0
226
1
14. distplot g = sns.FacetGrid(df_last, row="지역명", height=1.7, aspect=4) g.map(sns.distplot, "평당분양가격", hist=False, rug=True); 오류
0
178
1
group by agg function failed 에러
0
687
2
빈도수가 1000개 이상인 데이터를 따로 담을 때 코드 질문 있습니다.
0
288
2
주피터 노트북 실행 했는데 앞에 *가 생기고 결과가 나오지 않아요
0
363
3
get_string함수에서 문자 'nan'
0
200
1
seaborn X축 시작 지점 조정 질의의 건
0
213
1
14강 distplot 질의
0
289
1
nbextension 설치 및 셋팅 후 적용이 안되는 이슈
0
478
1
corr = df.corr() 입력시 오류
1
373
1
keyword grid_b is not recognized
0
336
1
%ls data 매직커맨드 사용시 한글 깨짐
0
293
1





