I have two dataframes, Dataframe 1 have 4 columns (A,B,C,D) with 20 rows and Dataframe 2 have same column headers as Dataframe 1 with 25 rows where first 20 rows are same as dataframe 1's 20 rows.
I want to Fetch the Dataframe 2's Unique 5 rows. and the fetching of those 5 rows should be done on index column.
Things that i've tried :
- I have tried the left outer join merge (it works but isn't efficient much)
- also tried the concatenation of two dataframes and then dropping the duplicates (it works only for 50% cases)
- also researched about the subtraction method but didn't understand anything
Kindly Help me through this problem, Thank you.
Edit:
Dataframe 1 :
| Date | Col1 | Col2 | Col3 |
|---|---|---|---|
| 10-2-2020 | rowdata | row data | row_data |
| 11-2-2020 | rowdata | row data | row_data |
| ... | ... | ... | ... |
| 20-2-2020 | rowdata | row data | row_data |
Dataframe 2 :
| Date | Col1 | Col2 | Col3 |
|---|---|---|---|
| 10-2-2020 | rowdata | row data | row_data |
| 11-2-2020 | rowdata | row data | row_data |
| ... | ... | ... | ... |
| 20-2-2020 | rowdata | row data | row_data |
| 21-2-2020 | rowdata | row data | row_data |
| ... | ... | ... | ... |
| 25-2-2020 | rowdata | row data | row_data |
I want the data which is unique which means this data : Result Dataframe :
| Date | Col1 | Col2 | Col3 |
|---|---|---|---|
| 21-2-2020 | rowdata | row data | row_data |
| ... | ... | ... | ... |
| 25-2-2020 | rowdata | row data | row_data |
and sometimes some data can be different in rows of both dataframe with same date index, but i don't care about that data all i want is above result dataframe