Conditional appending of data to a pandas dataframe
I found out that it is possible to do by doing the following merge.

I transposed the doy data, so it is all in 1 column.
merge_ID_doy = ak2012_1.merge(T01, how='inner', left_on=['coordID', 'doy'], right_on=['coordID', 'doy']).

Then it merges all the data with similar doy and coordID with each other.
I am fairly new in Python. I have two pandas data frames ak12_01 and T01
ak12_01
  objectid, coordID, year, doy
0 495395    5497     2001  120
and
T01
  coordID, year,  1,  2,  3, ...
0 5497     2001  249 251 231 ...
1 5498     2001  239 231 251 ...
I want to add a given value from T01 to ak12_01 on two conditions:
1) if T01['coordID'] == ak12_01['coordID']
2) if T01(column name) == ak12_01['doy'].
In the T01 dataset, the column names represent the doy (day of the year)
I get an error when comparing the 'coordID' from the two dataset as they are not equally long (Can only compare identically-labeled Series objects). Is there a smart way of adding the given value from T01 to ak_12_01 based on these to conditions?