I have dataframes first and second of the same length, where the first one's index is increments of 15 and the second is in increments of 1. I would like to assign one column of first to another of second.
e.g., something like below
import pandas as pd
first = pd.DataFrame({"index": [0, 15, 30], "value": [2.2, 2.2, 2.2]})
second = pd.DataFrame({"value": [3.2, 3.2, 3.2]})
first = first.set_index("index")
first.value = second.value
however, the indices are disparate so the above gives NaNs for first.value after the first row. I think one approach is to call reset_index() prior to assignment, but I believe this is a costly op? Is there an approach that doesn't involve resetting the index?