First, replace your empty cells with NaNs:
df[df[0]==""] = np.NaN
Now, Use ffill()
:
df.fillna(method='ffill')
# 0
#0 Text
#1 30
#2 30
#3 30
#4 31
#5 Text
#6 31
#7 31
#8 31
#9 32
More Related Contents:
- How to change column names from numbers to names [closed]
- How to provide a reproducible copy of your DataFrame with to_clipboard()
- Pandas groupby with delimiter join
- Replace values in a pandas series via dictionary efficiently
- How to plot multiple Seaborn Jointplot in Subplot
- Find column whose name contains a specific string
- pandas: merge (join) two data frames on multiple columns
- Pandas Extract Number from String
- Conditionally fill column values based on another columns value in pandas
- How to deal with multi-level column names downloaded with yfinance
- No module named ‘pandas._libs.tslibs.timedeltas’ in PyInstaller
- Pandas deleting row with df.drop doesn’t work
- How to translate “bytes” objects into literal strings in pandas Dataframe, Python3.x?
- Count number of words per row
- pandas or python equivalent of tidyr complete
- How can I see the formulas of an excel spreadsheet in pandas / python?
- Python pandas: remove everything after a delimiter in a string
- python pandas read_csv delimiter in column data
- Showing all index values when using multiIndexing in Pandas
- Pandas number rows within group in increasing order
- How to change the plot order of the categorical x-axis
- Python pandas: how to remove nan and -inf values
- Plot two levels of x_ticklabels on a pandas multi-index dataframe [duplicate]
- Create a pandas DataFrame from generator?
- AttributeError: module ‘numpy’ has no attribute ‘__version__’
- Pandas rank by multiple columns
- Search and replace dots and commas in pandas dataframe
- bash: Python import – Command not found for pandas
- Why do I get a KeyError when using pandas apply?
- Confusion about pandas copy of slice of dataframe warning