title: How to count specific string from coulmn (.dat file)?
body: <p>I am trying to calculate specific string from column [donor, acceptor], I got the result but unable to find all numbers. I want to count the total number occurrence of residues (LYS8-Side, VAL2-Main,.. POPE4-Side, POPE4-Side, ... etc. ) from each column.</p>
  <p>Input .dat file.
  <a href="https://iitbacin-my.sharepoint.com/:u:/g/personal/20002453_iitb_ac_in/ERCE5FrV6XBNsDneJd4aVuUBX5UVlVZvhh1kudi5vrUl0A?e=6slaUm" rel="nofollow noreferrer">https://iitbacin-my.sharepoint.com/:u:/g/personal/20002453_iitb_ac_in/ERCE5FrV6XBNsDneJd4aVuUBX5UVlVZvhh1kudi5vrUl0A?e=6slaUm</a></p>
  <p>Output I am expecting-</p>
  <p>Example:</p>
  <pre><code>donor Number of residues
  ASN15- 5
  VAL2 - 3
  </code></pre>
  <p>Same result expecting for acceptor column.</p>
  <p><strong>CODE I have written.</strong></p>
  <pre><code>import pandas as pd
  
  require_cols = [0,1,2,3]
  # read by default 1st sheet of an excel file
  df = pd.read_table('/home/user/Desktop/Inter_hbond_Peptide_resid_lipid_protein.dat', usecols = require_cols)
  df = pd.DataFrame({'donor': ['LYS8-Side'], 'acceptor': ['POPE4-Main'], 'occupancy': [26.27]})
  print(df)
  
  # find count 
  AA_Count = df.query('donor==&quot;LYS8-side&quot; \
  &amp; acceptor==&quot;POPE4-Main&quot;')['acceptor'].count()
  
  print('Number of donor-', end=&quot;&quot;)
  print(AA_Count)
  </code></pre>
  <p>Thank You!</p>