16 lines
359 B
Python
16 lines
359 B
Python
|
import pandas as pd
|
||
|
import random
|
||
|
import numpy as np
|
||
|
|
||
|
# 生成170条测试数据的函数
|
||
|
data=pd.read_csv('input_data/BomNodes.csv')
|
||
|
# 生成数据
|
||
|
df = pd.DataFrame(data)
|
||
|
df['产业种类'] = [random.choice([0, 1]) for _ in range(107)]
|
||
|
|
||
|
# 显示前几行
|
||
|
print(df.head())
|
||
|
|
||
|
# 保存数据到CSV文件
|
||
|
df.to_csv('input_data/测试 BomNodes.csv', index=False)
|