Skip to content

Commit d7f4177

Browse files
committed
Fixed Doc Errors
1 parent dd005ab commit d7f4177

File tree

1 file changed

+18
-21
lines changed

1 file changed

+18
-21
lines changed

pandas/tests/frame/methods/test_describe.py

+18-21
Original file line numberDiff line numberDiff line change
@@ -422,8 +422,8 @@ def test_describe_empty_percentiles(self):
422422
# Case 1: Passing an empty list
423423
result = df.describe(percentiles=[])
424424
expected = DataFrame(
425-
{"a": [5,3, 1.581139,1,5]},
426-
index=["count","mean","std","min","max"],
425+
{"a": [5, 3, 1.581139, 1, 5]},
426+
index=["count", "mean", "std", "min", "max"],
427427
)
428428
tm.assert_frame_equal(result, expected)
429429

@@ -438,37 +438,34 @@ def test_describe_with_single_percentile(self):
438438
# Case 1: Passing a single percentile
439439
result = df.describe(percentiles=[0.5])
440440
expected = DataFrame(
441-
{"a": [5, 3, 1.581139,1,3,5]},
442-
index=["count","mean","std","min","50%","max"],
441+
{"a": [5, 3, 1.581139, 1, 3, 5]},
442+
index=["count", "mean", "std", "min", "50%", "max"],
443443
)
444444
tm.assert_frame_equal(result, expected)
445-
446445

447446
def test_describe_empty_numpy_percentile(self):
448447
df = DataFrame({"a": [1, 2, 3, 4, 5]})
449-
450-
# Passing empty NumPy array as percentiles
448+
449+
# Passing empty NumPy array as percentiles
451450
result = df.describe(percentiles=np.array([]))
452451

453-
# Expected output should only include count, mean, std, min, and max (no percentiles)
452+
# Expected output should not include percentiles
454453
expected = DataFrame(
455-
{"a": [5, 3.0, 1.581139, 1, 5]},
456-
index=["count", "mean", "std", "min", "max"]
457-
)
454+
{"a": [5, 3.0, 1.581139, 1, 5]},
455+
index=["count", "mean", "std", "min", "max"],
456+
)
458457
tm.assert_frame_equal(result, expected)
459458

460-
461-
462459
def test_describe_empty_series_percentile(self):
463460
df = DataFrame({"a": [1, 2, 3, 4, 5]})
464-
465-
# Passing empty Series as percentiles
466-
result = df.describe(percentiles=pd.Series([], dtype=float))
467461

468-
# Expected output should only include count, mean, std, min, and max (no percentiles)
462+
# Passing empty Series as percentiles
463+
result = df.describe(percentiles=Series([], dtype=float))
464+
465+
# Expected output should not include percentiles
469466
expected = DataFrame(
470-
{"a": [5, 3.0, 1.581139, 1, 5]},
471-
index=["count", "mean", "std", "min", "max"]
472-
)
467+
{"a": [5, 3.0, 1.581139, 1, 5]},
468+
index=["count", "mean", "std", "min", "max"],
469+
)
473470

474-
tm.assert_frame_equal(result, expected)
471+
tm.assert_frame_equal(result, expected)

0 commit comments

Comments
 (0)