title: game played in same session python
body: <p>I have the following game data for PS5 (I am working on python 3.10),</p>
  <p><a href="https://i.stack.imgur.com/vIW4K.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vIW4K.png" alt="enter image description here" /></a></p>
  <p>session_number: sr_no for a session,<br>
  venue_number: The location where it is played, <br>
  game: Game played.<br>
  start_Ts: session start time<br>
  end_Ts=session end time<br></p>
  <p>I want to get an output where for each game I can see what other games were played in the same session and how many times. As an example:
  with <code>Ratchet &amp; Clank</code>, <code>Deathloop</code> is played two times in the same session, <code>Demon’s Souls</code>, <code>Godfall</code>, <code>Miles Morales</code> &amp; <code>Returnal</code> are played once in the same session. so basically outcome should look like this</p>
  <p><a href="https://i.stack.imgur.com/QgOoy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QgOoy.png" alt="enter image description here" /></a></p>
  <p>I put the numbers only for one game here.
  The following code will give the data frame in python same as in the picture.</p>
  <pre><code># Import pandas library
  import pandas as pd
  
  
  # initialize list of lists
  data = [[1,'v1','Ratchet &amp; Clank','29/08/2022 13:05:06','29/08/2022 13:54:52',38],[1,'v1','Demon’s Souls ','29/08/2022 13:05:06','29/08/2022 13:54:52',87],
          [2,'v1','Deathloop','29/08/2022 13:54:17','29/08/2022 14:06:18',89],\
          [2,'v1','Ratchet &amp; Clank','29/08/2022 13:54:17','29/08/2022 14:06:18',48],\
          [2,'v1','Miles Morales','29/08/2022 13:54:17','29/08/2022 14:06:18',5],\
          [3,'v1','Returnal','29/08/2022 14:11:00','29/08/2022 15:19:10',22],\
          [4,'v2','Deathloop','29/08/2022 20:27:32','29/08/2022 20:31:30',58],\
          [4,'v2','Returnal','29/08/2022 20:27:32','29/08/2022 20:31:30',97],\
          [4,'v2','Ratchet &amp; Clank','29/08/2022 20:27:32','29/08/2022 20:31:30',75],\
          [5,'v2','Demon’s Souls ','29/08/2022 20:35:10','29/08/2022 20:36:10',15],\
          [6,'v2','Dirt 5 ','29/08/2022 20:40:34','29/08/2022 20:42:04',94],\
          [7,'v2','Final Fantasy VII ','29/08/2022 20:45:07','29/08/2022 20:51:04',69],\
          [8,'v2','Dirt 5 ','29/08/2022 20:48:45','29/08/2022 20:49:55',85],\
          [9,'v3','Devil May Cry 5','29/08/2022 13:12:33','29/08/2022 13:58:57',90],\
          [10,'v3','Ratchet &amp; Clank','29/08/2022 14:44:07','29/08/2022 14:51:26',78],\
          [10,'v3','Godfall','29/08/2022 14:44:07','29/08/2022 14:51:26',36],\
          [11,'v3','Deathloop','29/08/2022 14:48:31','29/08/2022 14:49:58',43]]
    
  # Create the pandas DataFrame
  df = pd.DataFrame(data, columns=['session_number',  'VENUE_NUMBER', 'GAME', 'START_TS', 'END_TS',   'TIME_SEPENT'])
    
  # print dataframe.
  df
  </code></pre>
  <p>Please help...</p>