I ran a following simple script:
import sys
import pandas as pd
df = pd.DataFrame([[1,2,3], [4,5,6]])
df.to_csv(sys.stdout)
Expected Output (as standard output)
,0,1,2
0,1,2,3
1,4,5,6
However, I got no outputs on standard output by the program under Python 2.7.15 on macOS 10.12.6. Instead, it generated a file named <stdout>
which contains the expected output.
Interestingly, on the same OS, Python 3.6.5 could show the result as standard output without any problems, and virtualenved Python 3.6.5 could not show it (and generated the <stdout>
file).
Does anyone identify the cause of this result? The version of Pandas is 0.23.1.