title: How can I count comma separated values in one column of my panda table?
body: <p>I have the following code:</p>
  
  <pre><code>businessdata = ['Name of Location','Address','City','Zip Code','Website','Yelp',
  '# Reviews', 'Yelp Rating Stars','BarRestStore','Category',
  'Price Range','Alcohol','Ambience','Latitude','Longitude']
  
  business = pd.read_table('FL_Yelp_Data_v2.csv', sep=',', header=1, names=businessdata)
  print '\n\nBusiness\n'
  print business[:6]
  </code></pre>
  
  <p>It reads my file and creates a Panda table I can work with.
  What I need is to count how many categories are in each line of the 'Category' variable and store this number in a new column named '# Categories'. Here is the target column sample:</p>
  
  <pre><code>Category                                         
  French                                               
  Adult Entertainment , Lounges , Music Venues         
  American (New) , Steakhouses                        
  American (New) , Beer, Wine &amp; Spirits , Gastropubs 
  Chicken Wings , Sports Bars , American (New)         
  Japanese
  </code></pre>
  
  <p>Desired output:</p>
  
  <pre><code>Category                                        # Categories  
  French                                               1           
  Adult Entertainment , Lounges , Music Venues         3         
  American (New) , Steakhouses                         2        
  American (New) , Beer, Wine &amp; Spirits , Gastropubs   4         
  Chicken Wings , Sports Bars , American (New)         3         
  Japanese                                             1        
  </code></pre>
  
  <p>EDIT 1:</p>
  
  <p>Raw input = CSV file. Target column: "Category"
  I can't post screenshots yet. I don't think the values to be counted are lists.</p>
  
  <p>This is my code:</p>
  
  <pre><code>business = pd.read_table('FL_Yelp_Data_v2.csv', sep=',', header=1, names=businessdata, skip_blank_lines=True)
  #business = pd.read_csv('FL_Yelp_Data_v2.csv')
  
  business['Category'].str.split(',').apply(len)
  #not sure where to declare the df part in the suggestions that use it.
  
  print business[:6]
  </code></pre>
  
  <p>but I keep getting the following error:</p>
  
  <pre><code>TypeError: object of type 'float' has no len() 
  </code></pre>
  
  <p>EDIT 2: </p>
  
  <p>I GIVE UP. Thanks for all your help, but I'll have to figure something else.</p>