<h4 dir="auto">Code Sample, a copy-pastable example if possible</h4>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&quot;&quot;&quot;Bug pandas.&quot;&quot;&quot;
from pandas import read_csv, to_datetime

try:
    from StringIO import StringIO
except ImportError:
    from io import StringIO

dtf = read_csv(StringIO('Time, Value\n'
                        '2017-11-08 15:14:04.421,1\n'
                        '2017-11-08 15:14:05.528,2\n'
                        '2017-11-08 15:14:06.714,3\n'
                        '2017-11-08 15:14:07.113,4\n'
                        '2017-11-08 15:14:08.282,5\n'
                        '2017-11-08 15:14:08.681,6\n'
                        '2017-11-08 15:14:10.650,7\n'
                        '2017-11-08 15:14:11.826,8\n'
                        '2017-11-08 15:14:12.225,9\n'
                        '2017-11-08 15:14:13.416,10'))

dtf.Time = to_datetime(dtf.Time)
dtf.set_index('Time', inplace=True)
print(dtf)
dtf2 = dtf.resample('1s').bfill(limit=1)
print(dtf2)"><pre class="notranslate"><span class="pl-s">"""Bug pandas."""</span>
<span class="pl-k">from</span> <span class="pl-s1">pandas</span> <span class="pl-k">import</span> <span class="pl-s1">read_csv</span>, <span class="pl-s1">to_datetime</span>

<span class="pl-k">try</span>:
    <span class="pl-k">from</span> <span class="pl-v">StringIO</span> <span class="pl-k">import</span> <span class="pl-v">StringIO</span>
<span class="pl-k">except</span> <span class="pl-v">ImportError</span>:
    <span class="pl-k">from</span> <span class="pl-s1">io</span> <span class="pl-k">import</span> <span class="pl-v">StringIO</span>

<span class="pl-s1">dtf</span> <span class="pl-c1">=</span> <span class="pl-en">read_csv</span>(<span class="pl-v">StringIO</span>(<span class="pl-s">'Time, Value<span class="pl-cce">\n</span>'</span>
                        <span class="pl-s">'2017-11-08 15:14:04.421,1<span class="pl-cce">\n</span>'</span>
                        <span class="pl-s">'2017-11-08 15:14:05.528,2<span class="pl-cce">\n</span>'</span>
                        <span class="pl-s">'2017-11-08 15:14:06.714,3<span class="pl-cce">\n</span>'</span>
                        <span class="pl-s">'2017-11-08 15:14:07.113,4<span class="pl-cce">\n</span>'</span>
                        <span class="pl-s">'2017-11-08 15:14:08.282,5<span class="pl-cce">\n</span>'</span>
                        <span class="pl-s">'2017-11-08 15:14:08.681,6<span class="pl-cce">\n</span>'</span>
                        <span class="pl-s">'2017-11-08 15:14:10.650,7<span class="pl-cce">\n</span>'</span>
                        <span class="pl-s">'2017-11-08 15:14:11.826,8<span class="pl-cce">\n</span>'</span>
                        <span class="pl-s">'2017-11-08 15:14:12.225,9<span class="pl-cce">\n</span>'</span>
                        <span class="pl-s">'2017-11-08 15:14:13.416,10'</span>))

<span class="pl-s1">dtf</span>.<span class="pl-v">Time</span> <span class="pl-c1">=</span> <span class="pl-en">to_datetime</span>(<span class="pl-s1">dtf</span>.<span class="pl-v">Time</span>)
<span class="pl-s1">dtf</span>.<span class="pl-en">set_index</span>(<span class="pl-s">'Time'</span>, <span class="pl-s1">inplace</span><span class="pl-c1">=</span><span class="pl-c1">True</span>)
<span class="pl-en">print</span>(<span class="pl-s1">dtf</span>)
<span class="pl-s1">dtf2</span> <span class="pl-c1">=</span> <span class="pl-s1">dtf</span>.<span class="pl-en">resample</span>(<span class="pl-s">'1s'</span>).<span class="pl-en">bfill</span>(<span class="pl-s1">limit</span><span class="pl-c1">=</span><span class="pl-c1">1</span>)
<span class="pl-en">print</span>(<span class="pl-s1">dtf2</span>)</pre></div>
<h4 dir="auto">Problem description</h4>
<p dir="auto">Current output:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="                      Value
Time                       
2017-11-08 15:14:04     1.0
2017-11-08 15:14:05     2.0
2017-11-08 15:14:06     3.0
2017-11-08 15:14:07     4.0
2017-11-08 15:14:08     5.0
2017-11-08 15:14:09     NaN
2017-11-08 15:14:10     7.0
2017-11-08 15:14:11     8.0
2017-11-08 15:14:12     9.0
2017-11-08 15:14:13    10.0"><pre class="notranslate"><code class="notranslate">                      Value
Time                       
2017-11-08 15:14:04     1.0
2017-11-08 15:14:05     2.0
2017-11-08 15:14:06     3.0
2017-11-08 15:14:07     4.0
2017-11-08 15:14:08     5.0
2017-11-08 15:14:09     NaN
2017-11-08 15:14:10     7.0
2017-11-08 15:14:11     8.0
2017-11-08 15:14:12     9.0
2017-11-08 15:14:13    10.0
</code></pre></div>
<p dir="auto">Main issue: <code class="notranslate">NaN</code> is not expected.</p>
<p dir="auto">Secondary minor issue:<br>
<code class="notranslate">bfill</code> with <code class="notranslate">limit</code> is changing type of the column, <code class="notranslate">bfill</code> without <code class="notranslate">limit</code> is not changing the dtype</p>
<h4 dir="auto">Expected Output</h4>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="                      Value
Time                       
2017-11-08 15:14:04     1
2017-11-08 15:14:05     2
2017-11-08 15:14:06     3
2017-11-08 15:14:07     4
2017-11-08 15:14:08     5
2017-11-08 15:14:09     6
2017-11-08 15:14:10     7
2017-11-08 15:14:11     8
2017-11-08 15:14:12     9
2017-11-08 15:14:13    10"><pre class="notranslate"><code class="notranslate">                      Value
Time                       
2017-11-08 15:14:04     1
2017-11-08 15:14:05     2
2017-11-08 15:14:06     3
2017-11-08 15:14:07     4
2017-11-08 15:14:08     5
2017-11-08 15:14:09     6
2017-11-08 15:14:10     7
2017-11-08 15:14:11     8
2017-11-08 15:14:12     9
2017-11-08 15:14:13    10
</code></pre></div>
<h4 dir="auto">Output of <code class="notranslate">pd.show_versions()</code></h4>
<details>
<h2 dir="auto">INSTALLED VERSIONS</h2>
<p dir="auto">commit: None<br>
python: 2.7.13.final.0<br>
python-bits: 64<br>
OS: Darwin<br>
OS-release: 17.3.0<br>
machine: x86_64<br>
processor: i386<br>
byteorder: little<br>
LC_ALL: None<br>
LANG: None<br>
LOCALE: None.None</p>
<p dir="auto">pandas: 0.22.0<br>
pytest: None<br>
pip: 9.0.1<br>
setuptools: 34.3.0<br>
Cython: None<br>
numpy: 1.14.0<br>
scipy: None<br>
pyarrow: None<br>
xarray: None<br>
IPython: None<br>
sphinx: None<br>
patsy: None<br>
dateutil: 2.6.1<br>
pytz: 2017.3<br>
blosc: None<br>
bottleneck: None<br>
tables: None<br>
numexpr: None<br>
feather: None<br>
matplotlib: None<br>
openpyxl: None<br>
xlrd: None<br>
xlwt: None<br>
xlsxwriter: None<br>
lxml: None<br>
bs4: None<br>
html5lib: None<br>
sqlalchemy: None<br>
pymysql: None<br>
psycopg2: None<br>
jinja2: 2.9.5<br>
s3fs: None<br>
fastparquet: None<br>
pandas_gbq: None<br>
pandas_datareader: None<br>
None</p>
</details>
<p dir="auto">If a dataframe has a single row for a given index entry, it returns a Series. If it<br>
has two rows for that index, it returns a DataFrame. I believe that it should return a<br>
DataFrame in either case for consistency.</p>
<p dir="auto">Image attached, small dataframe and notebook exhibiting the problem attached. OK, so<br>
I can't attach either the dataframe or the notebook, even suffixing them with .txt (github barfs).<br>
So I'm pasting the text fragment after the image..</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/1727968/10252096/e0e7ed72-68fa-11e5-809c-a125c44a8fbf.png"><img width="959" alt="pandasinconsistenttypes" src="https://cloud.githubusercontent.com/assets/1727968/10252096/e0e7ed72-68fa-11e5-809c-a125c44a8fbf.png" style="max-width: 100%;"></a></p>
<p dir="auto">dataframe = '''<br>
Locus,Decision,Group,Var,Region,Gene,Rows,Mutation,Profile<br>
chr01:0018961727,Homopolymer,VS,CA,exonic,PAX7,1.0,synonymous SNV,000000010010001000000000001101<br>
chr01:0027057772,Bad,IR-PM-VS,CA,exonic,ARID1A,1.0,nonsynonymous SNV,000000000000000000001000100000<br>
chr01:0027057772,Bad,IR-PM-VS,CA,exonic,ARID1A,1.0,nonsynonymous SNV,000000000000000000011001110100<br>
chr01:0027057772,Bad,IR-PM-VS,CA,exonic,ARID1A,1.0,nonsynonymous SNV,100000000001010000010001110110<br>
'''<br>
df = [line.split(',') for line in txt.split('\n')]<br>
tdf = pd.DataFrame.from_records(df, index=(0,))<br>
tdf<br>
type(tdf.loc['chr01:0018961727']), type(tdf.loc['chr01:0027057772'])</p>