소개
게시글
질문&답변
2020.09.16
plot을 그릴때 데이터에 결측치가 있으면 그려지지 않는 컬럼이 있습니다.
네. 이미 개인적으로 환경이 구성되어 있어 초반 환경 설정 강의를 넘기고 진행해서 그런거 같습니다. 답변 주셔서 감사드립니다.
- 0
- 10
- 354
질문&답변
2020.09.16
plot을 그릴때 데이터에 결측치가 있으면 그려지지 않는 컬럼이 있습니다.
네. 1.4.1 입니다.
- 0
- 10
- 354
질문&답변
2020.09.16
plot을 그릴때 데이터에 결측치가 있으면 그려지지 않는 컬럼이 있습니다.
네. 다음과 같습니다. --------------------------------------------------------------------------- ValueError Traceback (most recent call last) /opt/conda/lib/python3.7/site-packages/statsmodels/nonparametric/kde.py in kdensityfft (X, kernel, bw, weights, gridsize, adjust, clip, cut, retgrid) 450 try : --> 451 bw = float ( bw ) 452 except : ValueError : could not convert string to float: 'scott' During handling of the above exception, another exception occurred: RuntimeError Traceback (most recent call last) in 1 columns = [ 'AMT_REQ_CREDIT_BUREAU_HOUR' ] ----> 2 show_hist_by_target ( app_train , columns ) in show_hist_by_target (df, columns) 6 fig , axs = plt . subplots ( nrows = 1 , ncols = 2 , figsize = ( 12 , 4 ) , squeeze = False ) 7 sns . violinplot ( x = 'TARGET' , y = column , data = df , ax = axs [ 0 ] [ 0 ] ) ----> 8 sns . distplot ( df [ cond_0 ] [ column ] , ax = axs [ 0 ] [ 1 ] , label = '0' , color = 'blue' ) 9 sns . distplot ( df [ cond_1 ] [ column ] , ax = axs [ 0 ] [ 1 ] , label = '1' , color = 'red' ) /opt/conda/lib/python3.7/site-packages/seaborn/distributions.py in distplot (a, bins, hist, kde, rug, fit, hist_kws, kde_kws, rug_kws, fit_kws, color, vertical, norm_hist, axlabel, label, ax) 231 if kde : 232 kde_color = kde_kws . pop ( "color" , color ) --> 233 kdeplot ( a , vertical = vertical , ax = ax , color = kde_color , ** kde_kws ) 234 if kde_color != color : 235 kde_kws [ "color" ] = kde_color /opt/conda/lib/python3.7/site-packages/seaborn/distributions.py in kdeplot (data, data2, shade, vertical, kernel, bw, gridsize, cut, clip, legend, cumulative, shade_lowest, cbar, cbar_ax, cbar_kws, ax, **kwargs) 703 ax = _univariate_kdeplot(data, shade, vertical, kernel, bw, 704 gridsize , cut , clip , legend , ax , --> 705 cumulative=cumulative, **kwargs) 706 707 return ax /opt/conda/lib/python3.7/site-packages/seaborn/distributions.py in _univariate_kdeplot (data, shade, vertical, kernel, bw, gridsize, cut, clip, legend, ax, cumulative, **kwargs) 293 x, y = _statsmodels_univariate_kde(data, kernel, bw, 294 gridsize , cut , clip , --> 295 cumulative=cumulative) 296 else : 297 # Fall back to scipy if missing statsmodels /opt/conda/lib/python3.7/site-packages/seaborn/distributions.py in _statsmodels_univariate_kde (data, kernel, bw, gridsize, cut, clip, cumulative) 365 fft = kernel == "gau" 366 kde = smnp . KDEUnivariate ( data ) --> 367 kde . fit ( kernel , bw , fft , gridsize = gridsize , cut = cut , clip = clip ) 368 if cumulative : 369 grid , y = kde . support , kde . cdf /opt/conda/lib/python3.7/site-packages/statsmodels/nonparametric/kde.py in fit (self, kernel, bw, fft, weights, gridsize, adjust, cut, clip) 138 density, grid, bw = kdensityfft(endog, kernel=kernel, bw=bw, 139 adjust = adjust , weights = weights , gridsize = gridsize , --> 140 clip=clip, cut=cut) 141 else : 142 density, grid, bw = kdensity(endog, kernel=kernel, bw=bw, /opt/conda/lib/python3.7/site-packages/statsmodels/nonparametric/kde.py in kdensityfft (X, kernel, bw, weights, gridsize, adjust, clip, cut, retgrid) 451 bw = float ( bw ) 452 except : --> 453 bw = bandwidths . select_bandwidth ( X , bw , kern ) # will cross-val fit this pattern? 454 bw *= adjust 455 /opt/conda/lib/python3.7/site-packages/statsmodels/nonparametric/bandwidths.py in select_bandwidth (x, bw, kernel) 172 # eventually this can fall back on another selection criterion. 173 err = "Selected KDE bandwidth is 0. Cannot estimate density." --> 174 raise RuntimeError ( err ) 175 else : 176 return bandwidth RuntimeError : Selected KDE bandwidth is 0. Cannot estimate density.
- 0
- 10
- 354
질문&답변
2020.09.16
plot을 그릴때 데이터에 결측치가 있으면 그려지지 않는 컬럼이 있습니다.
답변 감사드립니다. seaborn 버전 업그레이드 이후 위에 오류는 해결되었습니다. 다시 실행 해보니 'AMT_REQ_CREDIT_BUREAU_HOUR' 컬럼에서 아래와 같은 에러가 발생하였습니다. (사진) 실습 코드는 그대로 사용하고 있고, pandas 버전은 1.1.2 입니다. 해당 library 버전 정보를 알려주시면 동일하게 맞춰서 다시 해보겠습니다. 감사합니다.
- 0
- 10
- 354
질문&답변
2020.09.16
plot을 그릴때 데이터에 결측치가 있으면 그려지지 않는 컬럼이 있습니다.
안녕하세요. 아래와 같이 AMT_ANNUITY 컬럼의 distplot을 그릴때 발생합니다. (사진) (사진) seaborn library 버전은 0.9.0 입니다.
- 0
- 10
- 354