Community. I'm working with a Pandas Dataframe and I've reached a point where I need to sample two columns from the DataFrame. I want to do this by converting the sample to a multi-dimensional array but I do not know how to go from there. This is what I have done so far:
for i,j in abcarray:
if 'positive' in j:
print(abcarray[i])
get_image("img1")
elif 'negative' in j:
print(abcarray[i])
get_image("img2")
elif 'neutral' in j:
print(abcarray[i])
get_image("img3")
This is only supposed to print the ith element while the jth element is whatever I've specified. Now usually in Java, I could have a counter variable that iterates through the rows, but how do you do this in Python? I know that I could use "range(len(abcarray))" but it still doesn't help. I'm very new to Python but I have to use Python for this for obvious reasons.
Edit: Adding a bit more context here after the first few replies. So get_image is a function that checks the value and returns the appropriate image. That part of the code works absolutely fine so I did not include that.
The Dataframe is from a CSV but the sample looks like this
["Review Review Review Text Text Text Text" 'positive'] ["Review Review Review Text Text Text Text" 'negative'] ["Review Review Review Text Text Text Text" 'neutral'] ["Review Review Review Text Text Text Text" 'positive'] ["Review Review Review Text Text Text Text" 'positive']