python-2.7 - 将相同的标签循环到多文档
问题描述
我有一个带有给定数据框的文本文档语料库:
Category Document
0 a 1
1 None 2
2 None 3
3 None 4
... ... ...
10 None 9
当前编码:
inputfile = open("file.txt", 'r')
corpus = [w for w in inputfile]
label = ['a']
corpus_df = {'Document': corpus, 'Category': label}
corpus_df = pd.DataFrame.from_dict(corpus_df, orient='index')
print corpus_df.transpose()
我的问题是如何使其他文档具有与 D1 相同的类别?
解决方案
推荐阅读
- https - 在 Angular 中使用 HTTPS 访问后端 Web 服务
- firebase - Firebase + Express.js:如何从相关对象中检索数据
- mysql - 由于错误的mysql路径,在make sub-mysql时为qt构建mysql插件失败
- angular - 放大 Graphql 从数组中删除项目(角度)
- javascript - 如何使用 Javascript 中的 if 语句修复我的 while 循环
- python - 读取文件夹中的所有 CSV 文件并读取属于特定标题的内容并将数据写入 1 个 CSV 文件
- python - SQAlchemy 定时行更改可能吗?
- azure-devops - 如何杀死 devops 上的进程(最好是超时)
- python - ValueError:检查输入时出错:预期 time_distributed_input 的形状为 (None, 224, 224, 3) 但得到的数组的形状为 (224, 224, 3, 1)
- debugging - 有没有办法在vscode中调试vertx?