Skip to content

Commit 1781ee0

Browse files
committed
Merge branch 'fix_to_csv_issue_chunksize_8621' of https://github.com/papaloizouc/pandas into papaloizouc-fix_to_csv_issue_chunksize_8621
Conflicts: doc/source/whatsnew/v0.15.2.txt
2 parents b35b165 + 549422f commit 1781ee0

File tree

3 files changed

+31
-16
lines changed

3 files changed

+31
-16
lines changed

doc/source/whatsnew/v0.15.2.txt

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -90,22 +90,7 @@ Experimental
9090

9191
Bug Fixes
9292
~~~~~~~~~
93-
- Report a ``TypeError`` when invalid/no paramaters are passed in a groupby (:issue:`8015`)
94-
- Bug in packaging pandas with ``py2app/cx_Freeze`` (:issue:`8602`, :issue:`8831`)
95-
- Bug in ``groupby`` signatures that didn't include \*args or \*\*kwargs (:issue:`8733`).
96-
- ``io.data.Options`` now raises ``RemoteDataError`` when no expiry dates are available from Yahoo and when it receives no data from Yahoo (:issue:`8761`), (:issue:`8783`).
97-
- Unclear error message in csv parsing when passing dtype and names and the parsed data is a different data type (:issue:`8833`)
98-
- Bug in slicing a multi-index with an empty list and at least one boolean indexer (:issue:`8781`)
99-
- ``io.data.Options`` now raises ``RemoteDataError`` when no expiry dates are available from Yahoo (:issue:`8761`).
100-
- ``Timedelta`` kwargs may now be numpy ints and floats (:issue:`8757`).
101-
- Fixed several outstanding bugs for ``Timedelta`` arithmetic and comparisons (:issue:`8813`, :issue:`5963`, :issue:`5436`).
102-
- ``sql_schema`` now generates dialect appropriate ``CREATE TABLE`` statements (:issue:`8697`)
103-
- ``slice`` string method now takes step into account (:issue:`8754`)
104-
- Bug in ``BlockManager`` where setting values with different type would break block integrity (:issue:`8850`)
105-
- Bug in ``DatetimeIndex`` when using ``time`` object as key (:issue:`8667`)
106-
- Bug in ``merge`` where ``how='left'`` and ``sort=False`` would not preserve left frame order (:issue:`7331`)
10793
- Fix negative step support for label-based slices (:issue:`8753`)
108-
- Fix: The font size was only set on x axis if vertical or the y axis if horizontal. (:issue:`8765`)
10994

11095
Old behavior:
11196

@@ -130,6 +115,28 @@ Bug Fixes
130115
s = pd.Series(np.arange(3), ['a', 'b', 'c'])
131116
s.loc['c':'a':-1]
132117

118+
- Report a ``TypeError`` when invalid/no paramaters are passed in a groupby (:issue:`8015`)
119+
- Bug in packaging pandas with ``py2app/cx_Freeze`` (:issue:`8602`, :issue:`8831`)
120+
- Bug in ``groupby`` signatures that didn't include \*args or \*\*kwargs (:issue:`8733`).
121+
- ``io.data.Options`` now raises ``RemoteDataError`` when no expiry dates are available from Yahoo and when it receives no data from Yahoo (:issue:`8761`), (:issue:`8783`).
122+
- Unclear error message in csv parsing when passing dtype and names and the parsed data is a different data type (:issue:`8833`)
123+
- Bug in slicing a multi-index with an empty list and at least one boolean indexer (:issue:`8781`)
124+
- ``io.data.Options`` now raises ``RemoteDataError`` when no expiry dates are available from Yahoo (:issue:`8761`).
125+
- ``Timedelta`` kwargs may now be numpy ints and floats (:issue:`8757`).
126+
- Fixed several outstanding bugs for ``Timedelta`` arithmetic and comparisons (:issue:`8813`, :issue:`5963`, :issue:`5436`).
127+
- ``sql_schema`` now generates dialect appropriate ``CREATE TABLE`` statements (:issue:`8697`)
128+
- ``slice`` string method now takes step into account (:issue:`8754`)
129+
- Bug in ``BlockManager`` where setting values with different type would break block integrity (:issue:`8850`)
130+
- Bug in ``DatetimeIndex`` when using ``time`` object as key (:issue:`8667`)
131+
- Bug in ``merge`` where ``how='left'`` and ``sort=False`` would not preserve left frame order (:issue:`7331`)
132+
- Fix: The font size was only set on x axis if vertical or the y axis if horizontal. (:issue:`8765`)
133+
- Fixed division by 0 when reading big csv files in python 3 (:issue:`8621`)
134+
135+
136+
137+
138+
139+
133140

134141
- Imported categorical variables from Stata files retain the ordinal information in the underlying data (:issue:`8836`).
135142

pandas/core/format.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1247,7 +1247,7 @@ def __init__(self, obj, path_or_buf=None, sep=",", na_rep='', float_format=None,
12471247
self.data = [None] * ncols
12481248

12491249
if chunksize is None:
1250-
chunksize = (100000 / (len(self.cols) or 1)) or 1
1250+
chunksize = (100000 // (len(self.cols) or 1)) or 1
12511251
self.chunksize = int(chunksize)
12521252

12531253
self.data_index = obj.index

pandas/tests/test_frame.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6462,6 +6462,14 @@ def test_to_csv_chunking(self):
64626462
rs = read_csv(filename,index_col=0)
64636463
assert_frame_equal(rs, aa)
64646464

6465+
def test_to_csv_wide_frame_formatting(self):
6466+
# Issue #8621
6467+
df = DataFrame(np.random.randn(1, 100010), columns=None, index=None)
6468+
with ensure_clean() as filename:
6469+
df.to_csv(filename, header=False, index=False)
6470+
rs = read_csv(filename, header=None)
6471+
assert_frame_equal(rs, df)
6472+
64656473
def test_to_csv_bug(self):
64666474
f1 = StringIO('a,1.0\nb,2.0')
64676475
df = DataFrame.from_csv(f1, header=None)

0 commit comments

Comments
 (0)