title: Python: AttributeError: 'Timestamp' object has no attribute 'dt'
body: <p>I am new to Python</p>
  <p>I have a df- df_kpi_1, one of it's volume is df_kpi_1['YEAR_MONTH']</p>
  <pre><code>0       202004
  1       201912
  2       202002
  3       201908
  4       202001
           ...  
  1115    201911
  1116    202004
  1117    202006
  1118    201909
  1119    201909
  Name: YEAR_MONTH, Length: 1120, dtype: int64
  </code></pre>
  <p>I was trying to add another column as finical year, but get error</p>
  <pre><code>def FY(x):
      if pd.to_datetime(x,format='%Y%m').dt.month.between(7,12).any():
          return pd.to_datetime(x,format='%Y%m').dt.year +1
      else:
          return pd.to_datetime(x,format='%Y%m').dt.year
  df_kpi_1['YEAR_MONTH'].apply(FY)
  
  ---------------------------------------------------------------------------
  AttributeError                            Traceback (most recent call last)
  &lt;ipython-input-129-a8f657c9f50c&gt; in &lt;module&gt;
        4     else:
        5         return pd.to_datetime(x,format='%Y%m').series.dt.year
  ----&gt; 6 df_kpi_1['YEAR_MONTH'].apply(FY)
  
  C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\series.py in apply(self, func, convert_dtype, args, **kwds)
     3846             else:
     3847                 values = self.astype(object).values
  -&gt; 3848                 mapped = lib.map_infer(values, f, convert=convert_dtype)
     3849 
     3850         if len(mapped) and isinstance(mapped[0], Series):
  
  pandas\_libs\lib.pyx in pandas._libs.lib.map_infer()
  
  &lt;ipython-input-129-a8f657c9f50c&gt; in FY(x)
        1 def FY(x):
  ----&gt; 2     if pd.to_datetime(x,format='%Y%m').dt.month.between(7,12).any():
        3         return pd.to_datetime(x,format='%Y%m').series.dt.year +1
        4     else:
        5         return pd.to_datetime(x,format='%Y%m').series.dt.year
  
  AttributeError: 'Timestamp' object has no attribute 'dt'
  
  </code></pre>