AttributeError: 'builtin_function_or_method' object has no attribute 'is_unique'
12,017
Solution 1
df2
seems like a list of dates, you could then just use loc
to index the rows based on the DateTimeIndex
of `df1.
r = transactions.loc[impact]
print(r)
Solution 2
Try this (parens instead of square brackets for index
):
impact = trades.index(trades.zero == total_columns).astype(str).tolist()
trades_impact = transactions.join(impact)
Related videos on Youtube
Author by
Fran Martinez
Updated on June 04, 2022Comments
-
Fran Martinez almost 2 years
I have the following data frame:
df1
NumOfTransactions ComissionDeduction 2011-01-10 2 19.90 2011-01-13 2 19.90 2011-01-26 1 9.95
df2
['2011-01-10']
I need to join the two so I remain with the row in df1 for when that date is also in df2.
NumOfTransactions ComissionDeduction 2011-01-10 2 19.90
I'm trying to achieve that functionality using:
impact = trades.index[trades.zero == total_columns].astype(str).tolist() trades_impact = transactions.join(impact)
However, I'm receiving the following error;AttributeError: 'builtin_function_or_method' object has no attribute 'is_unique'
-
cs95 over 6 yearsIn your case, use
transactions.loc[impact]
-
-
combinatorist over 6 yearsFFR, try putting your error in google. It gave me stack overflow questions anyway and I got it in the third result with this answer: stackoverflow.com/a/27703120/5555637.
-
Fran Martinez over 6 yearsThank you, I appreciate your help. I will keep that in mind for a future occasion.