title: Python:How to count specific values in specific columns in a dataframe
body: <p>I have a particular csv for eg:</p>
  
  <pre><code>col1 col2 col3 col4
  
  a    1    2     3
  
  b    1    2     1 
  
  c    1    1     3
  
  d    3    1     2 
  </code></pre>
  
  <p>I want to count number of a particular value for eg. 1 in col2, col3 and col4</p>
  
  <p>I am using the following code using pandas</p>
  
  <pre><code>import pandas as pd
  
  fname = input('Enter the filename:')
  df = pd.read_csv (fname, header='infer')
  one = df.iloc[:,1:4].value_counts(normalize=False).loc[1]
  </code></pre>
  
  <p>It is showing error but when I am doing the same for a particular defined column the code is running properly</p>
  
  <pre><code>import pandas as pd
  fname = input('Enter the filename:')
  df = pd.read_csv (fname, header='infer')
  one = df[col1].value_counts(normalize=False).loc[1]
  </code></pre>
  
  <p>I want the following output</p>
  
  <pre><code>col2 3
  
  col3 2
  
  col4 1
  </code></pre>
  
  <p>Any help or tips would be greatly appreciated! Thank you in advance. :)</p>