下面的代码打印我想要的所有值,但第一行具有“日期”,最后一行具有“名称:关闭,长度:1828,dtype:float64”
import pandas as pd
from pandas.io.data import DataReader
from datetime import datetime
ibm = DataReader('IBM', 'yahoo', datetime(2009,1,1))
pd.set_option('display.max_rows',len(ibm))
print ibm["Close"]
Run Code Online (Sandbox Code Playgroud)
如何在第一行“日期”行和最后一行“名称:关闭,长度:1828,dtype:float64”行中不打印数据?切片不起作用,我试过print ibm [“ Close”] [1:-1],它只是切断了第二行和第二行到最后一行。
我收到此编译错误:
错误:一元
*'(have'int')的类型参数无效
_M_insert_unique_(end(), *__first);
我已经尝试过使用(*cols_it).first和(*cols_it).second我能想到的所有其他排列方式,但无法对其进行编译。我应该写什么?
这是一些代码:
#include <map>
#include <vector>
using std::map;
using std::vector;
void setZeroes(vector<vector<int> > &A) {
map<int,int> rows;
map<int,int> cols;
for (unsigned int x = 0; x < A[0].size(); x++) {
for (unsigned int y = 0; y < A.size(); y++) {
if (A[x][y] == 0) {
rows.insert(y,y); // error reported here
cols.insert(x,x);
}
}
}
map<int,int>::iterator rows_it = rows.begin();
map<int,int>::iterator cols_it = cols.begin();
while (rows_it != rows.end()) { …Run Code Online (Sandbox Code Playgroud)