提交 3193b551 编写于 作者: M MaoXianxin

replace groups

上级 911ad9d9
import yaml
import pandas as pd
import numpy as np
with open('/home/mao/Downloads/operation-work/explore/index.yml', 'r', encoding='utf-8') as stream:
try:
parse_yml = yaml.safe_load(stream)
print(parse_yml)
except yaml.YAMLError as exec:
print(exec)
csv = pd.read_csv('certification_organization.csv', usecols=['path'])
csv = csv.sort_values('path', ascending=False)
num_groups = np.arange(len(csv['path']))
np.random.shuffle(num_groups)
for i in range(len(parse_yml['groups'])):
parse_yml['groups'][i] = csv.iloc[num_groups[i], 0][1:]
with open('/home/mao/Downloads/operation-work/explore/index.yml', 'w', encoding='utf-8') as stream:
try:
yaml.safe_dump(parse_yml, stream)
except yaml.YAMLError as exec:
print(exec)
print(parse_yml['groups'])
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册