#将某一行的编码格式设置为 utf-8,支持中文显示和查找
stock_data['name'] = [i.encode('utf8') for i in stock_data['name']]#判断一列中的字符信息,并删除改行 for index,row in stock_data.iterrows():
if '退市'in row['name']:
stock_data.drop(index,axis=0,inplace=True)
本文介绍使用Python处理股票数据的方法,包括如何设置数据编码格式为UTF-8以支持中文显示和查找,以及如何通过检查特定关键词(如“退市”)来过滤数据。
#将某一行的编码格式设置为 utf-8,支持中文显示和查找
stock_data['name'] = [i.encode('utf8') for i in stock_data['name']]#判断一列中的字符信息,并删除改行 for index,row in stock_data.iterrows():
if '退市'in row['name']:
stock_data.drop(index,axis=0,inplace=True)
2183
1万+

被折叠的 条评论
为什么被折叠?