I have a dataframe, where one of the column is an integer id, and there are two other columns start and end which have floating point representation.
Some end values are nan. I want to set these end values that are nan to start for certain id, e.g., id == 1.
Here's an example:
df = pd.DataFrame({
"id": [0, 1, 1, 2, 2],
"start": [1.1, 1.2, 1.3, 1.4, 1.5],
"end": [1.1, float("nan"), 1.3, 1.4, float("nan")]
})
Afterwards, it should be
df = pd.DataFrame({
"id": [0, 1, 1, 2, 2],
"start": [1.1, 1.2, 1.3, 1.4, 1.5],
"end": [1.1, 1.2, 1.3, 1.4, float("nan")]
})