title: Python PANDAS: New Column, Apply Unique Value To All Rows
body: <p>Just looking for a best approach as someone who spends more time in data analysis land than programming proper (hat tip to you all).  Pretty straightforward, large ETL project but hand coding it in Python which is a first.  Fixed-width file is being read successfully into initial PANDAS df.  </p>
  
  <p>I am trying to add a new column with a static, end-of-month date value (2014-01-31, for example) indicating the "Data Month" for further EDW processing.  Ultimately, I am going to use datetime/timedelta functionality to pass this value as an automatically generated when I CRON it on the utility server.</p>
  
  <p>My confusion seems to be about which function to utilize (apply, mapapply, etc.), if I need to reference an index value in the original df to apply a completely unrelated value to the initial df, and the most optimized, pythonic way to accomplish this.  </p>
  
  <p>Currently referencing: "Python for Data Analysis", PANDAS Docs.  Thanks!</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Here is a small example of some fixed-width data:</p>
  
  <pre><code>5151022314 
  5113 22204
  111  20018
  </code></pre>
  
  <p>Here is some code for reading it into a PANDAS df:</p>
  
  <pre><code>import pandas as pd
  import numpy as np
  
  path = 'C:\Users\Office\Desktop\example data.txt' 
  widths = [2, 3, 5]
  names = (['STATE_CD', 'CNTY_CD', 'ZIP_CD',])
  
  df = pd.read_fwf(path, names=names, widths=widths, header=0)
  </code></pre>
  
  <p>This should return something like this as a df for the example date above:</p>
  
  <pre><code>STATE_CD,CNTY_CD,ZIP_CD
  51,510,22314     
  51,1  ,22204
  11,3  ,20018
  </code></pre>
  
  <p>What I am trying to do is add a column "DATA_MM" like this for all rows:</p>
  
  <pre><code>STATE_CD,CNTY_CD,ZIP_CD, DATA_MM
  51,510,22314,2014-01-31     
  51,1  ,22204,2014-01-31
  11,3  ,20018,2014-01-31
  </code></pre>
  
  <p>Ultimately, I am hoping to utilize something like this to generate the value that is applied automatically when this monthly job initiates:</p>
  
  <pre><code>import datetime
  today = datetime.date.today()
  first = datetime.date(day=1, month=today.month, year=today.year)
  lastMonth = first - datetime.timedelta(days=1)
  print lastMonth.strftime("%Y-%m-%d")
  </code></pre>