【发布时间】:2020-12-08 04:03:34
【问题描述】:
如何从列发布日期(例如:1995 年 1 月 1 日)中的所有数据中提取年份并分配给同一数据框中的“年份”列?
建议的一种方法是使用 split str.split() 方法。
movie id movie title release date unknown Action Adventure Animation Childrens Comedy Crime ... Film-Noir Horror Musical Mystery Romance Sci-Fi Thriller War Western movie genre
0 1 Toy Story 01-Jan-1995 0 0 0 1 1 1 0 ... 0 0 0 0 0 0 0 0 0 3
1 2 GoldenEye 01-Jan-1995 0 1 1 0 0 0 0 ... 0 0 0 0 0 0 1 0 0 3
2 3 Four Rooms 01-Jan-1995 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 1 0 0 1
3 4 Get Shorty 01-Jan-1995 0 1 0 0 0 1 0 ... 0 0 0 0 0 0 0 0 0 3
4 5 Copycat 01-Jan-1995 0 0 0 0 0 0 1 ... 0 0 0 0 0 0 1 0 0 3
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
1676 1678 Mat' i syn 06-Feb-1998 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 1
1677 1679 B. Monkey 06-Feb-1998 0 0 0 0 0 0 0 ... 0 0 0 0 1 0 1 0 0 2
1678 1680 Sliding Doors 01-Jan-1998 0 0 0 0 0 0 0 ... 0 0 0 0 1 0 0 0 0 2
1679 1681 You So Crazy 01-Jan-1994 0 0 0 0 0 1 0 ... 0 0 0 0 0 0 0 0 0 1
1680 1682 Scream of Stone (Schrei aus Stein) 08-Mar-1996 0 0 0 0 0 0 0 ... 0 0 0 0 0
【问题讨论】: