数据分析
八目智库
这个作者很懒,什么都没留下…
展开
-
SyntaxError: (unicode error) ‘unicodeescape‘ codec can‘t decode bytes in position 2-3 error
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape with open('C:\Update_Meteing\sambot_test.json','r') as jsonfile: 原因分析:在windows系统当中读取文件路径可以使用\,但是在python字符串中\有转义的含义,如\t可代表TAB,\n代表换行,所以我..原创 2021-02-05 18:22:34 · 138 阅读 · 0 评论 -
TypeError: ‘dict_keys‘ object is not subscriptable
运行Python3报错 Accountdetail = AccountsList[count1] 在python3中keys不允许切片,需要先转为List 示例: 将下行的代码转为 Accountdetail = AccountsList[count1] 此行代码即可 Accountdetail = list(AccountsList)[count1]原创 2020-12-14 00:45:40 · 193 阅读 · 0 评论 -
pandas获取指定的列和行
pandas获取指定的列和行 house_info = pd.read_csv('house_info.csv') 1:取行的操作: house_info.loc[3:6]类似于python的切片操作 2:取列操作: house_info['price'] 这是读取csv文件时默认的第一行索引 3:取两列 house_info[['price',tradetypename']] 取多个列也是同理的,注意里面是一个list的列表,不然会报错误; 4:增加列: house_Info['adr.转载 2020-10-12 19:37:50 · 611 阅读 · 0 评论