在熊猫中将str转换为int

时间:2018-10-30 02:59:49

标签: pandas

我有一栏是这样的:

<v-btn v-bind:class="Object.values(btn.size)">
  {{ btn.text }}
</v-btn>

我想这样将天转换为int天:

day
2018-10-30
2018-9-25
2018-9-30

这是我的代码:

intday
20181030
2018925
2018930

但是它不起作用,如何解决?

2 个答案:

答案 0 :(得分:7)

我推荐

pd.to_datetime(df.day).dt.strftime('%Y%m%d').astype(int)
Out[56]: 
0    20181030
1    20180925
2    20180930
Name: day, dtype: int32

答案 1 :(得分:5)

您可以使用override fun nextScheduledActivity(thisStateRef: StateRef, flowLogicRefFactory: FlowLogicRefFactory): ScheduledActivity? { System.out.println("inside scheduled activity " ) val scheduledAt = Instant.now().plusSeconds(10) val logicRef = flowLogicRefFactory.create(SFlow::class.java, thisStateRef) var toReturn: ScheduledActivity? = ScheduledActivity(logicRef, scheduledAt) return toReturn } 删除-,然后将其强制转换为int:

str.replace