I want to merge two big dataframes going like this:
            loc  val
2019-09-01  0    23.2
2019-09-02  0    13.2
...
2019-11-01  0    12.9
2019-09-01  1    21.2
2019-09-01  1    26.7
...
2019-11-01  1    13.5
...
2019-09-01  4    23.4
...
2019-11-01  4    17.8
so, in other words, as index I have many datetimes for each loc, with loc running from 0 to 4.
I have 2 of these dataframes. I want to join them by the loc column BUT at the same time I want to take the indexes into consideration in an inner way. So if I have as a 2nd dataframe:
            loc  val
2019-09-02  0    54.8
2019-09-03  0    11.7
...
so the merge will be something like:
            loc  val    val
2019-09-01  0    23.2   NaN
2019-09-02  0    13.2   54.8
...
Do you know if this is possible? I would like something like this (it were possible):
df = pd.merge(df1, df2, on="loc", left_index=True, right_index=True)
I have been testing with merge but I don't know how to do it. Thanks.
 
     
    