Skip to content

Test Case for to_csv to sys.stdout #21561

Closed
@hawkeyej

Description

@hawkeyej

Code Sample, a copy-pastable example if possible

#! /usr/bin/env python3

import sys
import pandas as pd
import numpy as np

data = pd.DataFrame(np.random.randint(low=0, high=10, size=(5, 5)),
                    columns=['a', 'b', 'c', 'd', 'e'])

print('--------- Output ----------')
data.to_csv(sys.stdout, index=False)
print('---------------------------')

Problem description

No output to sys.stdout.

Expected Output

+++++++++ Output ++++++++++
a,b,c,d,e
8,7,1,3,4
6,7,0,1,2
8,0,9,4,1
1,1,9,0,4
8,1,2,9,2
+++++++++++++++++++++++++++

Output with 0.23.1

+++++++++ Output ++++++++++
+++++++++++++++++++++++++++

Output of pd.show_versions()

INSTALLED VERSIONS

commit: None
python: 3.6.5.final.0
python-bits: 64
OS: Linux
OS-release: 4.4.0-128-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8

pandas: 0.23.1
pytest: None
pip: 10.0.1
setuptools: 39.2.0
Cython: None
numpy: 1.14.5
scipy: 1.1.0
pyarrow: None
xarray: None
IPython: 6.4.0
sphinx: 1.7.5
patsy: None
dateutil: 2.7.3
pytz: 2018.4
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: 2.2.2
openpyxl: 2.5.4
xlrd: 1.1.0
xlwt: 1.3.0
xlsxwriter: 1.0.5
lxml: 4.2.1
bs4: None
html5lib: 1.0.1
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None

Metadata

Metadata

Assignees

No one assigned

    Labels

    IO DataIO issues that don't fit into a more specific labelTestingpandas testing functions or related to the test suitegood first issue

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions