I have an iris dataset, and I need to use 1. the first 50 rows, 2. the 50-100 row 3. the 100-150 row. How can I do that? The first 50 rows are pretty simple to get, I just use iris.head(50), how about the other 2? The whole code looks like this:
import pandas as pd
import numpy as np
from sklearn.datasets import load_iris
import matplotlib.pyplot as plt
iris_data = load_iris()
iris = pd.DataFrame(data=np.c_[iris_data['data'], iris_data['target']],
columns=iris_data['feature_names'] + ['species'])
setosa = iris.head(50)
del setosa ['species']
print(setosa.columns)
plt.boxplot(setosa, vert=True)
plt.title(f"Features of the setosa")
plt.xticks([1, 2, 3, 4], ['sepal length', 'sepal width', 'petal length', 'petal width'])
plt.xlabel('Features')
plt.ylabel("Length/Width (cm)")
plt.show()
I expect to get data from the 50th row to 100th row,and from 100th row to 150th row