0
그래서 데이터 프레임을 그룹화 한 다음 함수를 적용하고 있습니다. 이제 프레임의 각 행을 확인하여 데이터 프레임의 나머지 행에 대해 확인하고 일부 조건과 일치하는 경우 태그의 일종으로 다른 데이터 프레임에 추가하고 원본에서 제거하고 싶습니다. 그것은 조건을 통과하지 않으면 내가 거기에 행을 유지하고 다음 행으로 이동합니다.데이터 프레임의 행을 반복하고 나머지 행과 비교하십시오.
예를 들어
time status number action fname lname
0 10.30 Active 2 0 Adrian Peter
1 11.01 Active 3 2 Peter Thomas
2 11.05 Passive 2 0 Thomas Adrian
3 11.07 Passive 2 1 Jen Anniston
그래서 내가 할 일 같은
df.groupby(status).apply(f)
def f(x):
I want to perform some tasks here and with the remaining dataframe
i want to see if index 0 has similar number and action in the
remaining data frame. If true i want to put this in a different dataframe and tag it and remove the pair from the origial df.
I want to then move on to the next index and do the same. If false after looking at all the data in the frame i want to delete this from the original df too
입력 예제에 몇 가지 샘플 출력을 추가하면 더 쉽게 따라갈 수 있습니다. – miradulo