【发布时间】:2018-10-09 16:07:28
【问题描述】:
所以我正在使用 Python 3 进行编程,并且想使用 pandas 库数据框打印出数据集(csv 文件)的维度,并且还做一些我不太了解的其他事情?这只是一个例子,因为我只需要解释如何。 假设我有 2 个功能:
在 func1 中,我(据说)使用 pandas 加载了一个数据集:
def func1(a):
namesOfColumns = ["The sepal-length", "The sepal-width", "The petal-length", "The petal-width", "class"]
a = "some_file"
some_file = pd.read_csv(a)
return (some_file)
def func2(数据):
#code for printing the dimensions of the dataset
#code for printing the top 3 lines
#code for printing the mean and standard variation of the sepal-width
#code for plot box plot of each attribute
有人能解释我如何处理 func2 中的步骤吗?
【问题讨论】:
-
打印尺寸:
a.shape,打印前 n 行:a.head(n),打印标准,平均值:df[column].std(),df[column].mean()
标签: python python-3.x pandas csv dataframe