강의

멘토링

커뮤니티

Inflearn Community Q&A

freedom07's profile image
freedom07

asked

Getting started with Python data analysis using public data

[12/21] Creating a text preprocessing function using regular expressions

get_string 에서 결측치 관련

Written on

·

198

1

선생님~

df['편익시설'] = df['공원보유시설(편익시설)'].map(get_string)

-> 여기서는 결측치 Nan이 ""으로 바뀌지 않고 그대로 결측치값으로 반환이 되었는데

fac = ",".join(df.loc[df['편익시설'].notnull(), '편익시설'])

fac = get_string(fac)

/

fac = str(df['편익시설'].tolist())

fac = get_string(fac)

-> 여기 두 곳에서는 결측치 nan 값이  join이나 str로 인해 모두 문자열이 되어

결측치도 문자 'nan'으로 인식되어서 ""으로 바뀐건가요? 

pythonpandasnumpy

Answer 1

0

todaycode님의 프로필 이미지
todaycode
Instructor

네 맞습니다.

get_string 함수에서 정규표현식으로 변경해 주는 코드가 있습니다.

freedom07's profile image
freedom07

asked

Ask a question