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 8f200a8

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

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

‎03-数据表清洗.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,12 @@ datetime.now().strftime('%F')
356356
df.loc[~df['apply_date'].isna(),'apply_month'] = \
357357
df.loc[~df['apply_date'].isna(),'apply_date'].map(lambda x: x.strftime('%Y年-%m月'))
358358

359+
# 八位数字转日期格式
360+
from dateutil.parser import parse
361+
a=20190613
362+
b=str(a)
363+
c=parse(b)
364+
359365
# Time
360366
df['weekday'] = df['starttime'].apply(lambda s : s.weekday()) # Monday is 0 and Sunday is 6
361367
df['hour'] = df['starttime'].apply(lambda s : s.hour)

0 commit comments

Comments
(0)

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