Skip to content

Commit fe12c8a

Browse files
committed
ENH: special option for writing infs in csvs no longer needed
1 parent d73b033 commit fe12c8a

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

pandas/core/frame.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -1105,9 +1105,7 @@ def _helper_csvexcel(self, writer, na_rep=None, cols=None,
11051105
for i, col in enumerate(cols):
11061106
val = series[col][j]
11071107
if lib.checknull(val):
1108-
# HACK: special-case option for including nan, inf, -inf in csv
1109-
if na_rep != 'nans_and_infs':
1110-
val = na_rep
1108+
val = na_rep
11111109

11121110
if float_format is not None and com.is_float(val):
11131111
val = float_format % val

pandas/tests/test_frame.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -3389,7 +3389,7 @@ def test_to_csv_from_csv_w_some_infs(self):
33893389
self.frame['G'] = np.nan
33903390
self.frame['H'] = self.frame.index.map(lambda x: [np.inf, np.nan][np.random.rand() < .5])
33913391

3392-
self.frame.to_csv(path, na_rep='nans_and_infs')
3392+
self.frame.to_csv(path)
33933393
recons = DataFrame.from_csv(path)
33943394

33953395
assert_frame_equal(self.frame, recons)
@@ -3404,7 +3404,7 @@ def test_to_csv_from_csv_w_all_infs(self):
34043404
self.frame['E'] = np.inf
34053405
self.frame['F'] = -np.inf
34063406

3407-
self.frame.to_csv(path, na_rep='nans_and_infs')
3407+
self.frame.to_csv(path)
34083408
recons = DataFrame.from_csv(path)
34093409

34103410
assert_frame_equal(self.frame, recons)

0 commit comments

Comments
 (0)