OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Rearrange rows after comparing the simliar data

  • Thread starter Thread starter Nitin Gaur
  • Start date Start date
N

Nitin Gaur

Guest
I have four columns organized into two pairs. The first pair consists of (Home Team, Away Team), and the second pair is (HomeTeam, AwayTeam). My objective is to align rows where the teams in the first pair exactly match those in the second pair, ensuring they are in the same row. Additionally, when I move data in the columns of the second pair, all corresponding data in subsequent columns should move accordingly.

In the image I shared, in row 4, we have (Tottenham, Southampton) as the first pair. Instead of being in the 4th row, the second pair (Tottenham, Southampton) is currently in the 7th row. To correct this, I need to move the second pair from the 7th row to the 4th row. During this movement, the data in columns (HTHG, First Half Score, HTAG, Home Shot) should also be moved alongside the second pair (HomeTeam, AwayTeam).

It is a bonus if I can get a solution to achieve this using Python as I am learning it and using jupyter notebook. Otherwise, it will also fine if I can get the solution in Google Sheet.

enter image description here
<p>I have four columns organized into two pairs. The first pair consists of (Home Team, Away Team), and the second pair is (HomeTeam, AwayTeam). My objective is to align rows where the teams in the first pair exactly match those in the second pair, ensuring they are in the same row. Additionally, when I move data in the columns of the second pair, all corresponding data in subsequent columns should move accordingly.</p>
<p>In the image I shared, in row 4, we have (Tottenham, Southampton) as the first pair. Instead of being in the 4th row, the second pair (Tottenham, Southampton) is currently in the 7th row. To correct this, I need to move the second pair from the 7th row to the 4th row. During this movement, the data in columns (HTHG, First Half Score, HTAG, Home Shot) should also be moved alongside the second pair (HomeTeam, AwayTeam).</p>
<p>It is a bonus if I can get a solution to achieve this using Python as I am learning it and using jupyter notebook. Otherwise, it will also fine if I can get the solution in Google Sheet.</p>
<p><a href="https://i.sstatic.net/wi7C3HXY.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/wi7C3HXY.png" alt="enter image description here" /></a></p>
 

Latest posts

Top