为什么这个完全简单的代码会出错:
#include <string>
using namespace std::string_literals;
int main() {
auto s = "cat"s;
}
Run Code Online (Sandbox Code Playgroud)
给出这个错误:
hello.cpp:4:16: error: expected ';' at end of declaration
auto s = "cat"s;
Run Code Online (Sandbox Code Playgroud)
这个编译器是否具体,因为我正在阅读官方资源,如:https://msdn.microsoft.com/en-us/library/69ze775t.aspx.
我的机器运行osx我使用终端和g ++编译:
g++ -v
Run Code Online (Sandbox Code Playgroud)
吐出:
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 8.0.0 (clang-800.0.38)
Target: x86_64-apple-darwin16.0.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
Run Code Online (Sandbox Code Playgroud)
我编译了它
g++ -o hello hello.cpp
Run Code Online (Sandbox Code Playgroud)
和
g++ -std=c++11 hello.cpp -o hello
Run Code Online (Sandbox Code Playgroud)
他们都显示错误.
有任何想法吗?
我有一个形状为 (418, 13) 的 DataFrame,我只想将两列复制到一个新的 DataFrame 中以输出到 csv 文件。(我在写预测)
csv_pred = prediction[["PassengerId", "Survived"]].copy()
csv_pred.to_csv('n.csv')
Run Code Online (Sandbox Code Playgroud)
但是,当我查看输出的 csv 文件时,我看到了:
,PassengerId,Survived
0,892,0
1,893,1
2,894,0
. . .
. . .
Run Code Online (Sandbox Code Playgroud)
而不是我所期望的:
"PassengerId","Survived"
892,0
893,1
894,0
Run Code Online (Sandbox Code Playgroud)
有谁知道为什么我的代码不起作用?提前致谢。