我有两个DataFrame:
<div class="box-body no-padding">
<canvas id="canvas" height="450" width="610"></canvas>
</div>
<script src="https://raw.githubusercontent.com/nnnick/Chart.js/master/Chart.min.js" ></script>
<script>
var PieChart = [
{
value: 40,
color:"#fcc79e"
},
{
value : 30,
color : "#beefd2"
},
{
value : 90,
color : "#ffddfb"
}
];
var myPieChart = new Chart(document.getElementById("canvas").getContext("2d")).Pie(PieChart);
</script>
我想:
来自df1:
15/12/2015 15/11/2015 15/10/2015
Stock
AA 10 11 11
BB 20 10 8
CC 30 33 26
DD 40 80 60
df2:
a b c
Stock
AA 2 11 22
BB 4 14 33
CC 3 12 30
DD 5 16 40
:
然后从df1
:
新行包含:
df2
答案 0 :(得分:0)
由于这些DataFrame共享相同的索引,因此您可以使用掩码进行索引:
In [11]: df1['15/12/2015'] < df1['15/11/2015']
Out[11]:
Stock
AA True
BB False
CC True
DD True
dtype: bool
In [12]: df2[df1['15/12/2015'] < df1['15/11/2015']]
Out[12]:
a b c
Stock
AA 2 11 22
CC 3 12 30
DD 5 16 40