Python Forum
How to ger matching rows data based on index columns
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to ger matching rows data based on index columns
#1
I have below pandas dataframe,
df1: 
[python]
                A         B         C         D
2000-01-01  0.469112 -0.282863 -1.509059 -1.135632
2000-01-02  1.212112 -0.173215  0.119209 -1.044236
2000-01-03 -0.861849 -2.104569 -0.494929  1.071804
2000-01-04  0.721555 -0.706771 -1.039575  0.271860
2000-01-05 -0.424972  0.567020  0.276232 -1.087401
2000-01-06 -0.673690  0.113648 -1.478427  0.524988
2000-01-07  0.404705  0.577046 -1.715002 -1.039268
2000-01-08 -0.370647 -1.157892 -1.344312  0.844885
df2:

                   A         B         C         D
2000-01-01  0.409571  0.113086 -0.610826 -0.936507
2000-01-03  1.152571  0.222735  1.017442 -0.845111
2000-01-05 -0.921390 -1.708620  0.403304  1.270929
2000-01-07  0.662014 -0.310822 -0.141342  0.470985
2000-01-09 -0.733231  0.509598 -0.580194  0.724113
I want get the row index where index of df2 is exactly equal to df2 index.
In this case
row0,row2,row4,row6 (assumed that rows are numbered from 0,1,2,3,4,5,6,7,8,9 etc)
I want the output as

2000-01-01  0.469112 -0.282863 -1.509059 -1.135632
2000-01-03 -0.861849 -2.104569 -0.494929  1.071804
2000-01-05 -0.424972  0.567020  0.276232 -1.087401
2000-01-07  0.404705  0.577046 -1.715002 -1.039268
Can some one help me how get the matching rows data based on index column.
Reply


Messages In This Thread
How to ger matching rows data based on index columns - by SriRajesh - Mar-07-2019, 03:01 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Matching Data - Help - Dictionary manuel174102 1 406 Feb-02-2024, 04:47 PM
Last Post: deanhystad
  how do you style data frame that has empty rows. gsaray101 0 535 Sep-08-2023, 05:20 PM
Last Post: gsaray101
  Grouping Data based on 30% bracket purnima1 4 1,198 Mar-10-2023, 07:38 PM
Last Post: deanhystad
  Converting a json file to a dataframe with rows and columns eyavuz21 13 4,503 Jan-29-2023, 03:59 PM
Last Post: eyavuz21
  (Python) Pulling data from UA Google Analytics with more than 100k rows into csv. Stockers 0 1,237 Dec-19-2022, 11:11 PM
Last Post: Stockers
  Extracting Data into Columns using pdfplumber arvin 17 5,590 Dec-17-2022, 11:59 AM
Last Post: arvin
  How to properly format rows and columns in excel data from parsed .txt blocks jh67 7 1,886 Dec-12-2022, 08:22 PM
Last Post: jh67
  Check DataFrames with different sorting in columns and rows Foxyskippy 0 781 Nov-19-2022, 07:49 AM
Last Post: Foxyskippy
  Deleting rows based on cell value in Excel azizrasul 11 2,659 Oct-19-2022, 02:38 AM
Last Post: azizrasul
  How to assign a value to pandas dataframe column rows based on a condition klllmmm 0 845 Sep-08-2022, 06:32 AM
Last Post: klllmmm

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020