时间格式
摘要:pandas中时间字符串转换为年月日方法总结。 创建一个dataframe df = pd.DataFrame(['2019-12-09', '2019-12-02'], columns=["date"]) 方法1:先转换为时间类型,在获取年月日 # 转换为时间类型 df["date"] = pd.
阅读全文
可视化:pyecharts与geo
摘要:可视化可以直接利用: init_opts=opts.InitOpts(width="800px",height="600px", # animation_opts=opts.AnimationOpts(animation_delay=1000, animation_easing="elasticOu
阅读全文
特征工程与集成学习参考代码
摘要:1.引入包 import pandas as pd import numpy as np import re 2.读取数据 train=pd.read_csv("训练数据.csv",encoding="gbk") 3.设置最大显示列数目 pd.set_option("display.max_colu
阅读全文
可视化:pandas与pyecharts、堆叠图、Stack_bar_percent
摘要:官网地址:https://gallery.pyecharts.org/#/Bar/stack_bar_percent bar=Bar(init_opts = opts.InitOpts(height='350px')) for label in pm_a["分段"].unique(): p = pm
阅读全文
pandas使用正则表达式对某列数字进行提取
摘要:python对正则表达式进行处理流程: 1.引入re模块 2.根据要求编写正则表达式 3.使用compile进行编译 4.match、search、find等函数进行匹配。 import re data_Month["价格"]=data_Month.apply(lambda x:GetMuch(x[
阅读全文