I have a pandas DataFrame
that has multiple columns in it:
Index: 239897 entries, 2012-05-11 15:20:00 to 2012-06-02 23:44:51
Data columns:
foo 11516 non-null values
bar 228381 non-null values
Time_UTC 239897 non-null values
dtstamp 239897 non-null values
dtypes: float64(4), object(1)
where foo
and bar
are columns which contain the same data yet are named differently. Is there are a way to move the rows which make up foo
into bar
, ideally whilst maintaining the name of bar
?
In the end the DataFrame should appear as:
Index: 239897 entries, 2012-05-11 15:20:00 to 2012-06-02 23:44:51
Data columns:
bar 239897 non-null values
Time_UTC 239897 non-null values
dtstamp 239897 non-null values
dtypes: float64(4), object(1)
That is the NaN values that made up bar were replaced by the values from foo
.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…