title: ValueError: No axis named node2 for object type <class 'pandas.core.frame.DataFrame'>
body: <pre><code>import pandas as pd
  import numpy as np
  from datetime import datetime
  
  data = {'date': ['1998-03-01 00:00:01', '2001-04-01 00:00:01','1998-06-01 00:00:01','2001-08-01 00:00:01','2001-05-03 00:00:01','1994-03-01 00:00:01'], 
          'node1': [1, 1, 2,2,3,2],
       'node2': [8,316,26,35,44,56],
       'weight': [1,1,1,1,1,1], }
  
  df2 = pd.DataFrame(data, columns = ['date', 'node1','node2','weight'])
  
  
  df2['date'] = pd.to_datetime(df2['date'])
  
  l1 = [1990,1991,1992,1993,1994,1995,1996,1997,1998]
  l2 = [1999,2000,2001]
  ndf = df2[df2['date'].dt.year.isin(l1+l2)]
  
  mask = ndf.groupby('node1','node2').apply(lambda x : (x['date'].dt.year.isin(l1)).any())
  mask2 = ndf.groupby('node1','node2').apply(lambda x : (x['date'].dt.year.isin(l2)).any())
  </code></pre>
  
  <p>the error I am getting-</p>
  
  <pre><code>Traceback (most recent call last):
    File "datanew.py", line 32, in &lt;module&gt;
      mask = ndf.groupby('node1','node2').apply(lambda x : (x['date'].dt.year.isin(l1)).any())
    File "C:\Python27\lib\site-packages\pandas\core\generic.py", line 5159, in groupby
      axis = self._get_axis_number(axis)
    File "C:\Python27\lib\site-packages\pandas\core\generic.py", line 357, in _get_axis_number
      .format(axis, type(self)))
  ValueError: No axis named node2 for object type &lt;class 'pandas.core.frame.DataFrame'&gt;
  </code></pre>
  
  <p>I have defined column 'node2' in data but still the error is saying no axis with node2.What seems to be the problem?</p>