Whenever a dataset comes the first step is to extract data and manipulate it. It is the most important part as it gives the most useful information about the dataset. I have taken the IPL dataset. Let's see how it's done.
每当数据集出现时,第一步就是提取数据并对其进行处理。 这是最重要的部分,因为它提供了有关数据集的最有用的信息。 我已经获取了IPL数据集。 让我们看看它是如何完成的。
At first, we need to import libraries such as pandas and NumPy.
首先,我们需要导入诸如pandas和NumPy之类的库。
After that, we need to read the dataset. I am using a “df” variable to store the dataset.
之后,我们需要读取数据集。 我正在使用“ df”变量来存储数据集。
After reading the dataset. If we want the first 5 rows of the dataset then we can use the head function. It is not compulsory that we will only get the top 5 rows. we can pass any value between the head function. If we do df.head(10) then we will get the top 10 rows of the dataset.
读取数据集后。 如果我们想要数据集的前5行,则可以使用head函数。 我们只获得前5行不是强制性的。 我们可以在head函数之间传递任何值。 如果执行df.head(10),则将获得数据集的前10行。