때때로 중복 행이있을 수있는 2 개의 CSV 파일을 결합하여 온도 시계열을 업데이트하려고합니다.pandas 데이터 프레임 타임 시리즈 중복 복제
drop_duplicates
을 구현하려고했지만 나에게 적합하지 않습니다. 여기
import pandas as pd
import numpy as np
from pandas import DataFrame, Series
dfA = DataFrame({'date' : Series(['1/1/10','1/2/10','1/3/10','1/4/10'], index=[0,1,2,3]),
'a' : Series([60,57,56,50], index=[0,1,2,3]),
'b' : Series([80,73,76,56], index=[0,1,2,3])})
print("dfA")
print(dfA)
dfB = DataFrame({'date' : Series(['1/3/10','1/4/10','1/5/10','1/6/10'], index=[0,1,2,3]),
'a' : Series([56,50,59,75], index=[0,1,2,3]),
'b' : Series([76,56,73,89], index=[0,1,2,3])})
print("dfB")
print(dfB)
dfC = dfA.append(dfB)
print(dfC.duplicated())
dfC.drop_duplicates()
print("dfC")
print(dfC)
을 그리고 이것은 출력 :
dfA
a b date
0 60 80 1/1/10
1 57 73 1/2/10
2 56 76 1/3/10
3 50 56 1/4/10
dfB
a b date
0 56 76 1/3/10
1 50 56 1/4/10
2 59 73 1/5/10
3 75 89 1/6/10
0 False
1 False
2 False
3 False
0 True
1 True
2 False
3 False
dtype: bool
dfC
a b date
0 60 80 1/1/10
1 57 73 1/2/10
2 56 76 1/3/10
3 50 56 1/4/10
0 56 76 1/3/10
1 50 56 1/4/10
2 59 73 1/5/10
3 75 89 1/6/10
내가 데이터를 중복으로 시계열을 업데이트하지 않는 방법 중복?
안녕하세요 빌 : 이것 좀 봐 http://stackoverflow.com/questions/13035764/remove-rows-with-duplicate-indices-pandas-dataframe-and-timeseries –
"나에게 효과가 없다"고 말하는 대신, ~ 될거야. * 왜 * 작동하지 않는지 설명하는 데 도움이됩니다. 예외, 나쁜 결과 또는 전혀 응답이 없습니까? – skrrgwasme