200字范文,内容丰富有趣,生活中的好帮手!
200字范文 > 使用 pandas读取 excel 文件的数据

使用 pandas读取 excel 文件的数据

时间:2020-03-05 08:26:45

相关推荐

使用 pandas读取 excel 文件的数据

注意:运行代码的时候请关闭 excel 文件。

# read excel and filter the number with regular expressionimport pandas as pdimport redf = pd.read_excel('D:\\健康养生\\217种常见食物的嘌呤含量表.xlsx')# print(df)# print(df['foodName'])for i in df['foodName']:new_str = re.sub('[0-9]', '', i) # substitute 将数字替换为无字符print(new_str)

正则表达式请参考

/python3/python3-reg-expressions.html

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。