[英]How to remove the last character from a column of data from a CVS file?
I am trying to do a linear relation using a csv file with 3 columns of data.我正在尝试使用具有 3 列数据的 csv 文件进行线性关系。 Unfortunately I am unable to read the 3rd (last column as int because it has an ';'
in the end of each value. For example 213124121;
, 1231231;
etc.不幸的是,我无法读取第 3 列(最后一列为 int,因为它在每个值的末尾都有一个';'
。例如213124121;
, 1231231;
等。
data["the price;"] = df['the price;'].astype('int64')
Error:错误:
ValueError: invalid literal for long() with base 10: '399900; '
How can I remove the ';'
我怎样才能删除';'
for the whole column?整个专栏?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.