【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)
相关推荐
benchmark_cc21 小时前
批量获取量化数据时,如何设置合理的超时和重试机制?——QuantDash 高性能实战指南
开发语言·人工智能·python·pandas·量化·quantdash
2601_9669496521 小时前
使用 Pandas 读取批量数据时如何避免内存溢出?QuantDash 量化数据工程师避坑指南
开发语言·python·pandas·tushare·akshare·quantdash
三十岁老牛再出发2 天前
08.18每日总结
c++·python·numpy·pandas
虎头金猫5 天前
如何在群晖NAS上通过Docker部署CloudSaver?群晖部署CloudSaver教程|聚合资源搜索并实现远程访问
运维·服务器·网络·python·docker·容器·pandas
Uncommon.6 天前
使用pandas处理csv并转为张量
pytorch·python·深度学习·pandas
STR_Liang8 天前
pandas.read_html 报错FileNotFoundError、OSError Traceback (most recent call last)
pandas
㳺三才人子9 天前
初探 Data Analysis - Matplotlib
python·plotly·pandas·matplotlib
quantdash_cc10 天前
告别自建 Requests/BS4 网页爬虫:基于 QuantDash 搭建零维保的高性能量化行情流水线
开发语言·爬虫·python·pandas·量化·quantdash
菜冻鱼10 天前
Python-sklearn-评估指标
开发语言·人工智能·python·机器学习·numpy·pandas·sklearn
菜冻鱼10 天前
Python-sklearn-模型选择
开发语言·人工智能·python·机器学习·numpy·pandas·sklearn