Another way is to explicitly fill column D with A,B,C in that order.
df['D'] = np.nan
df['D'] = df.D.fillna(df.A).fillna(df.B).fillna(df.C)
More Related Contents:
- How to write this code without using pandas?
- How to plot in multiple subplots
- Faster way to read Excel files to pandas dataframe
- How to reversibly store and load a Pandas dataframe to/from disk
- Format y axis as percent
- float64 with pandas to_csv
- How do I transpose dataframe in pandas without index?
- How to select all columns whose names start with X in a pandas DataFrame
- Why does pandas apply calculate twice
- pandas or python equivalent of tidyr complete
- pandas replace multiple values one column
- Matplotlib – fixing x axis scale and autoscale y axis
- Extracting specific selected columns to new DataFrame as a copy
- Get pandas.read_csv to read empty values as empty string instead of nan
- Custom transformer for sklearn Pipeline that alters both X and y
- Pandas join/merge/concat two dataframes
- Assign pandas dataframe column dtypes
- pandas replace zeros with previous non zero value
- How do I make the width of the title box span the entire plot?
- Renaming columns in a Pandas dataframe with duplicate column names?
- Ranking order per group in Pandas
- How to edit properties of whiskers, fliers, caps, etc. in Seaborn boxplot
- Convert list into a pandas dataframe
- Change main plot legend label text
- How to determine whether a column/variable is numeric or not in Pandas/NumPy?
- Python Pandas: Convert “.value_counts” output to dataframe
- What are the pros and cons between get_dummies (Pandas) and OneHotEncoder (Scikit-learn)?
- Can you format pandas integers for display, like `pd.options.display.float_format` for floats?
- computing the mean for python datetime
- Pandas explode multiple columns [duplicate]