0

I have a Excel sheet with two columns, I want to copy paste all of the values from one column into the other column, but here comes the tricky part. In the column where I want to copy the values has also empty values, so when I paste the whole Column I lose the entries in the column where I wanna paste the values. Maybe an example would make it easier to understand:

import pandas as pd
import numpy as np

df = pd.DataFrame({'A': [4534.0, 3412.0, 4523.0, 67657.0, 3423.0],
               'B': [3423, np.nan, 23234, np.nan, np.nan]})

print(df)

I want to copy the values from Column B into Column A without losing the Vales in Column A (they should not turn into NaN).

This question does not refer to the duplicate, I do not want to fill the NaN values I want to assign the values from Column B to A without turning any values in Column a to NaN

Thanks for your help in advance :)

bimarian
  • 130
  • 1
  • 11

0 Answers0