Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 将修改后的表列转换为整数_Python_Python 3.x - Fatal编程技术网

Python 将修改后的表列转换为整数

Python 将修改后的表列转换为整数,python,python-3.x,Python,Python 3.x,我有一个表,其中有一列表示日期。日期显示为MM/YY。我需要找到2025年的所有日期 我已经做了以下工作: ecom["Date"].str[3:] 所以我只有一年的时间 ecom["Date"].str[3:] == 25 这返回了一群布尔人,即使是在2025年,他们都是错误的 这是因为: ecom["Date"].str[3:] 这不是一个数字。如果我输入 int(ecom["Date"].str[3:]) 我听说 cannot convert the series to <c

我有一个表,其中有一列表示日期。日期显示为MM/YY。我需要找到2025年的所有日期

我已经做了以下工作:

ecom["Date"].str[3:]
所以我只有一年的时间

ecom["Date"].str[3:] == 25
这返回了一群布尔人,即使是在2025年,他们都是错误的

这是因为:

ecom["Date"].str[3:]
这不是一个数字。如果我输入

int(ecom["Date"].str[3:])
我听说

cannot convert the series to <class 'int'>
无法将序列转换为
我想知道如何实现int(或类似)。 我也很清楚,我可以将25声明为字符串,因为这也可以使用,但是我想知道如何将ecom[“Date”].str[3:]转换为数字


非常感谢

您能试试ecom[“日期”]吗?aType(int32)或ecom[“日期”]。aType(float)?
pd。使用数字
更安全我想说: