Reputation: 178
I am trying to plot a scatterplot using only data from rows 0 to 34 and 80 to 1001. I have tried the following code but it doesn't work:
plt.scatter(df.iloc[[0:34, 80:101], 1], df.iloc[[0:34, 80:101], 0])
I have also tried doing it conditional, using index numbers, but I cannot refer to the index.
What is the way to do this?
Upvotes: 1
Views: 88
Reputation: 34086
You can use numpy.r_
for selecting multiple ranges at once:
Try this:
import numpy as np
plt.scatter(df.iloc[np.r_[0:34, 80:101], 1], df.iloc[np.r_[0:34, 80:101], 0])
Upvotes: 1