pyecharts 安装地图包
pip install echarts-countries-pypkg |
报错 Unknown or unsupported command 'install'
这可能是因为我最近装了很多的环境导致的冲突,比如 php,java 环境等等。
解决方法:
pip.exe install echarts-countries-pypkg |
参考:pip 命令提示 unknow or unsupported command install 解决方法
连接两个表
gg_commu_data = pd.merge(gg_data,way_commu_data,on = 'call_id',how = 'left') |
报错
ValueError: You are trying to merge on int64 and object columns. If you wish to proceed you should use pd.concat
这是,主键数据类型不同,一个是 int,一个是对象。解决方法,更改数据类型。
合并两个列为一列
两列数据类型一样
- 直接合并
way_commu_data['new'] = way_commu_data['business_name'] + way_commu_data['inter_idx']
- 加符号
way_commu_data['new'] = way_commu_data['business_name'] +"|" + way_commu_data['inter_idx'].map(str)
数据类型不同
如果某一列是非 str 类型的数据,那么我们需要用到 map (str) 将那一列数据类型做转换 。
dataframe["newColumn"] = dataframe["age"].map(str) + dataframe["phone"] + dataframe["address”]
- 在某一列中加入字符串。
- 用一列的非空值填充另一列对应的空值
way_commu_data.loc[way_commu_data['business_name_new'].isnull(),'business_name_new']=way_commu_data[way_commu_data['business_name_new'].isnull()]['inter_idx']
报错
提取包含某些字符的字段报错
#找出target中包含字符1的列 |
报错:ValueError: cannot index with vector containing NA / NaN values
解决方法:
#找出target中包含字符1的列 |
参考:
1.stack
2.csdn
PPT 动态图实现方案
将 pyecharts 的图生成 html 文件。
命令:wordcloud.render()
文件读取
读取 txt 文件时,报错
filename3 = 'C:/Users/admin/Desktop/commu_data3.txt' |
ParserError: Error tokenizing data. C error: Expected 21 fields in line 3, saw 22
看他的意思是,底层的 C 代码不能解析数据,采用以下方案,将解析引擎设置为 python。
filename3 = 'C:/Users/admin/Desktop/commu_data3.txt' |
文件夹批量读取 glob
import glob |
v1.5.2