我有一个类似于此的DataFrame:
while ($token != null) {
require 'ListInboundShipmentsByNextToken.php';
$request->setNextToken($token);
echo print_r($request);
// Create new XML document.
$shipmentXML = invokeListInboundShipmentsByNextToken($service, $request);
$shipments = new SimpleXMLElement($shipmentXML);
// Use XML document to create array of all shipments.
foreach ($shipments->ListInboundShipmentsResult->ShipmentData->member as $member) {
$shipmentArray[] = array(
"ShipmentId"=>$member->ShipmentId,
"ShipmentStatus"=>$member->ShipmentStatus
);
}
$token = $shipments->ListInboundShipmentsResult->NextToken;
}
我想使用两个比较运算符添加一列。像这样:
0
0 3
1 11
2 7
3 15
我希望我的回报看起来像这样:
df[1] = np.where(df[1]<= 10,1 & df[1]>10,0)
但是,我收到此错误消息:
0 1
0 3 1
1 11 0
2 7 1
3 15 0
任何帮助将不胜感激!
答案 0 :(得分:0)
<强>设置强>
SELECT
DISTINCT DETAIL.DETAIL_ITEM_NUM,
Max(DETAIL.DETAIL_RECD_DATE) AS MaxOfDETAIL_RECD_DATE
FROM HEADER
INNER JOIN
DETAIL ON HEADER.HEADER_PO_NUM = DETAIL.DETAIL_PO_NUM
GROUP BY DETAIL.DETAIL_ITEM_NUM;
<强>解决方案强>
df = pd.DataFrame({'0': {0: 3, 1: 11, 2: 7, 3: 15}})
Out[1292]:
0
0 3
1 11
2 7
3 15