I am working on excel sheet:
animal name age
dog puppy 1
dog doggy 2
dog snooppy 3
cat pussy 1
pig piggy 1
pig cutty 2
rabit robby 1
rabbit bunny 2
Here I should check if animal age is 1 should delete that row and print next row and remove duplicates if there are no duplicates, should print that row and this output should print in other excel sheet.
Can any help me out of this?
import
imatplotlib.pyplot as plt
import pandas as pd
data = pd.read_excel(r"C:\Users\c_ssaiva\Desktop\sampladata.xlsx")
for index,row in data.iterrows():
print(index,row['animal'],row['name'],row['age'])
for j,row in data.iterrows():
if a[i] == a[j]:
if a[i] == 1
print a[j]
else:
print (a[i])
df = data
df.to_excel(r"C:\Users\c_ssaiva\Desktop\selcol.xlsx")