当我尝试编译以下内容时(g ++ 4.6.3)
class A {};
A& operator*=( A& a, const A& b )
{
return a;
}
A operator*( const A& a, const A& b )
{
return A( a ) *= b;
}
int main( int, char*[] )
{
A a, b;
a = a*b;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我收到了错误
/tmp/test.cxx: In function ‘A operator*(const A&, const A&)’:
/tmp/test.cxx:14:20: error: no match for ‘operator*=’ in ‘(* & a) *= b’
/tmp/test.cxx:14:20: note: candidate is:
/tmp/test.cxx:6:1: note: A& operator*=(A&, const …Run Code Online (Sandbox Code Playgroud) 我需要将一个pandas.Series对象作为一行写入CSV文件,而不是作为列.干脆做
the_series.to_csv( 'file.csv' )
Run Code Online (Sandbox Code Playgroud)
给我一个这样的文件:
record_id,2013-02-07
column_a,7.0
column_b,5.0
column_c,6.0
Run Code Online (Sandbox Code Playgroud)
我需要的是这样的:
record_id,column_a,column_b,column_c
2013-02-07,7.0,5.0,6.0
Run Code Online (Sandbox Code Playgroud)
这需要使用pandas 0.10,因此使用the_series.to_frame().transpose()不是一个选项.
是否有一种简单的方法可以转换系列,或者将其写成一行?
谢谢!