mesa/测试数据 设备id和设备残值.py

26 lines
693 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import pandas as pd
import numpy as np
# 设置随机种子以确保结果可重复
np.random.seed(42)
# 定义行数,即生成多少个设备
num_rows = 10
# 生成设备id例如100到200之间的设备ID
device_ids = np.random.randint(100, 200, size=num_rows)
# 生成设备残值假设范围在1000到10000之间
device_salvage_values = np.random.randint(10, 1000, size=num_rows)
# 创建数据框将设备id和设备残值结合起来
df_devices = pd.DataFrame({
'设备id': device_ids,
'设备残值': device_salvage_values
})
# 保存为CSV文件
file_path_devices = '测试数据 device_salvage_values.csv'
df_devices.to_csv(file_path_devices, index=False)