【Pandas】常用api(加精)

list转dataframe

用于制作label

python 复制代码
label_list = []
for label in df_label_data.values:
    if label == 0:
        label_list.append([0, 0]) # 
    elif label == 1:
        label_list.append([1, 0]) # 曝光点击了ctr,未点击购买
    elif label == 2:
        label_list.append([1, 1]) # 曝光点击了,且点击购买了


print(df_label_data.values)
[0 0 0 ... 0 0 0]
python 复制代码
df_label = pd.DataFrame(np.array(label_list), columns=['click', 'conversion'])
print(df_label.shape)

(17717195, 2)
相关推荐
星越华夏15 小时前
PPTX判断包含图表id
python·pandas
Cloud_Shy61816 小时前
Python 数据分析基础入门:《Excel Python:飞速搞定数据分析与处理》学习笔记系列(第十一章 Python 包跟踪器 上篇)
python·数据分析·excel·pandas·matplotlib
小郑加油2 天前
python学习Day14:实际应用——pandas的筛选与保存
python·学习·pandas
Cloud_Shy6182 天前
Python 数据分析基础入门:《Excel Python:飞速搞定数据分析与处理》学习笔记系列(第十章 Python 驱动的 Excel 工具 上篇)
vscode·python·数据分析·excel·pandas
Cloud_Shy6182 天前
Python 数据分析基础入门:《Excel Python:飞速搞定数据分析与处理》学习笔记系列(第十章 Python 驱动的 Excel 工具 下篇)
笔记·python·学习·数据分析·excel·pandas
川冰ICE2 天前
Python爬虫实战⑳|Pandas时间序列,趋势分析一网打尽
爬虫·python·pandas
小郑加油2 天前
python学习Day13:实际应用——pandas 进阶计算
python·学习·pandas
码界筑梦坊4 天前
118-基于Python的游戏账号数据可视化分析系统
python·游戏·信息可视化·毕业设计·pandas·fastapi
川冰ICE4 天前
Python爬虫实战⑲|Pandas数据合并与重塑,多数据源整合
爬虫·python·pandas
Cloud_Shy6184 天前
Python 数据分析基础入门:《Excel Python:飞速搞定数据分析与处理》学习笔记系列(第八章 使用读写包操作 Excel 文件 上篇)
python·数据分析·excel·pandas