computing daily return/increment on dataframe
<p>So ive some timeseries data on which i want to compute daily return/increment, where Daily increment = value_at_time(T)/ value_at_time(T-1)</p>

<pre><code>import pandas as pd
df=pd.DataFrame([1,2,3,7]) #Sample data frame
df[1:]
out:
 0
 1  2
 2  3
 3  7
df[:-1]
out: 
    0
 0  1
 1  2
 2  3
######### Method 1
df[1:]/df[:-1]
out:
    0
0 NaN
1   1
2   1
3 NaN

######### Method 2
df[1:]/df[:-1].values
out:
          0
1  2.000000
2  1.500000
3  2.333333

######### Method 3
df[1:].values/df[:-1]
out:
   0
0  2
1  1
2  2
</code></pre>

<p>My questions are that </p>

<ol>
<li>If df[:-1] and df[1:] have only three values (row slices of the
dataframe) then why doesnt Method_1 work ?</li>
<li>Why are method 2 &amp; 3 which are almost similar giving different results?</li>
<li>Why using .values in Method_2 makes it work</li>
</ol>