【发布时间】:2019-05-31 19:39:36
【问题描述】:
我被要求根据旧变量的数据生成一个新变量。基本上,被问到的是我从原始值中随机取值(通过使用random 函数),并且观察值至少是旧值的 10 倍,然后将其保存为新变量。
这是我的数据集:https://archive.ics.uci.edu/ml/machine-learning-databases/forest-fires/forestfires.csv
我想使用的变量是area
这是我的尝试,但它给了我一个module object is not callable 错误:
import pandas as pd
import random as rand
dataFrame = pd.read_csv("https://archive.ics.uci.edu/ml/machine-learning-databases/forest-fires/forestfires.csv")
area = dataFrame['area']
random_area = rand(area)
print(random_area)
【问题讨论】:
-
@vigneshkrishnan 抱歉,这并不能回答这个问题,样本量大于总体量。谢谢。
标签: python pandas dataframe random sample