を使用して時間への変換時間I持って、次のデータフレーム、df
:パンダラムダ
no. site_number date time Class Speed_KPH
0 11 2016-02-27 00:00:13.0000000 Short 43
1 11 2016-02-27 00:02:15.0000000 Short 45
2 11 2016-02-27 00:00:28.0000000 Short 31
3 11 2016-02-27 00:03:28.0000000 Short 31
が、私はそれが与えられた時間の終わりを与えるように、time
列から、time_slot
を新しい列を作成したいです。
no. site_number date time Class Speed_KPH Hour_slot
0 11 2016-02-27 00:00:13.0000000 Short 43 1
1 11 2016-02-27 00:02:15.0000000 Short 45 3
2 11 2016-02-27 00:00:28.0000000 Short 31 1
3 11 2016-02-27 00:03:28.0000000 Short 31 4
私は時間に時間を変換する機能を定義した後、新しい列、time_slot
を定義するためにラムダ計算を使用します。
AttributeError: ("'str' object has no attribute 'hour'", u'occurred at index 0')