I have a python pandas dataframe that has 3 rows in it:
Name Time count
AAA 5:45 5
BBB 13:01 8
CCC 11:16 3
I am trying to loop through this dataframe and if the count is greater than 5, i have to populate that row to a new dataframe. I know the count is 2 from a function as only 2 rows are greater than 5. I tried the below code but it is not working. Any help would be appreciated.
for i in range(2):
if(row['Occurences'] >= 5 ):
df6.loc[i] = [df4['MachineName'], df4['DateTime'], df4['Count']]
df6
I tried this code - res is empty, I am appending the rows to res based on the condition.
res = pd.DataFrame(columns=('MachineName', 'DateTime', 'Occurences'))
print(pd.concat([res, df4[df4['Occurences'] >= 5]]))
res
df4[df4['Count'] >= 5]?