Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 889a9c5

Browse files
Update 03-数据表清洗.md
1 parent 4f15c0e commit 889a9c5

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

‎03-数据表清洗.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,13 @@ for col in columns:
149149
df[col] = df[col].astype('float')
150150
df[col].fillna(-999, inplace = True)
151151
df[col] = df[col].astype('int')
152+
153+
# 批量转化为浮点格式
154+
for i in df.columns:
155+
try:
156+
df[i] = df[i].apply(lambda x:float(x))
157+
except:
158+
pass
152159
```
153160

154161
<br/>

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /