Skip to content

Commit 4401bec

Browse files
committed
WIP: update doctests
1 parent e9661da commit 4401bec

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

sdks/python/apache_beam/dataframe/pandas_doctests_test.py

+19-3
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ def test_ndframe_tests(self):
6969
],
7070
'pandas.core.generic.NDFrame.fillna': [
7171
"df.fillna(method='ffill')",
72+
'df.fillna(method="ffill")',
7273
'df.fillna(value=values, limit=1)',
7374
],
7475
'pandas.core.generic.NDFrame.sort_values': ['*'],
@@ -163,6 +164,7 @@ def test_dataframe_tests(self):
163164
'pandas.core.frame.DataFrame.diff': ['*'],
164165
'pandas.core.frame.DataFrame.fillna': [
165166
"df.fillna(method='ffill')",
167+
'df.fillna(method="ffill")',
166168
'df.fillna(value=values, limit=1)',
167169
],
168170
'pandas.core.frame.DataFrame.items': ['*'],
@@ -235,13 +237,18 @@ def test_dataframe_tests(self):
235237
# reindex not supported
236238
's2 = s.reindex([1, 0, 2, 3])',
237239
],
240+
'pandas.core.frame.DataFrame.reindex': ['*'],
241+
'pandas.core.frame.DataFrame.resample': ['*'],
242+
'pandas.core.frame.DataFrame.values': ['*'],
238243
},
239244
not_implemented_ok={
240245
'pandas.core.frame.DataFrame.transform': [
241246
# str arg not supported. Tested with np.sum in
242247
# frames_test.py::DeferredFrameTest::test_groupby_transform_sum
243248
"df.groupby('Date')['Data'].transform('sum')",
244249
],
250+
'pandas.core.frame.DataFrame.swaplevel': ['*'],
251+
'pandas.core.frame.DataFrame.melt': ['*'],
245252
'pandas.core.frame.DataFrame.reindex_axis': ['*'],
246253
'pandas.core.frame.DataFrame.round': [
247254
'df.round(decimals)',
@@ -272,6 +279,8 @@ def test_dataframe_tests(self):
272279
'df.dot(s2)',
273280
],
274281

282+
'pandas.core.frame.DataFrame.resample': ['df'],
283+
'pandas.core.frame.DataFrame.asfreq': ['*'],
275284
# Throws NotImplementedError when modifying df
276285
'pandas.core.frame.DataFrame.axes': [
277286
# Returns deferred index.
@@ -384,6 +393,7 @@ def test_series_tests(self):
384393
],
385394
'pandas.core.series.Series.fillna': [
386395
"df.fillna(method='ffill')",
396+
'df.fillna(method="ffill")',
387397
'df.fillna(value=values, limit=1)',
388398
],
389399
'pandas.core.series.Series.items': ['*'],
@@ -432,10 +442,10 @@ def test_series_tests(self):
432442
's.drop_duplicates()',
433443
"s.drop_duplicates(keep='last')",
434444
],
435-
'pandas.core.series.Series.repeat': [
436-
's.repeat([1, 2, 3])'
437-
],
438445
'pandas.core.series.Series.reindex': ['*'],
446+
'pandas.core.series.Series.repeat': ['s.repeat([1, 2, 3])'],
447+
'pandas.core.series.Series.resample': ['*'],
448+
'pandas.core.series.Series': ['ser.iloc[0] = 999'],
439449
},
440450
not_implemented_ok={
441451
'pandas.core.series.Series.transform': [
@@ -450,13 +460,16 @@ def test_series_tests(self):
450460
],
451461
},
452462
skip={
463+
# Relies on setting values with iloc
464+
'pandas.core.series.Series': ['ser', 'r'],
453465
'pandas.core.series.Series.groupby': [
454466
# TODO(BEAM-11393): This example requires aligning two series
455467
# with non-unique indexes. It only works in pandas because
456468
# pandas can recognize the indexes are identical and elide the
457469
# alignment.
458470
'ser.groupby(ser > 100).mean()',
459471
],
472+
'pandas.core.series.Series.asfreq': ['*'],
460473
# error formatting
461474
'pandas.core.series.Series.append': [
462475
's1.append(s2, verify_integrity=True)',
@@ -490,6 +503,7 @@ def test_series_tests(self):
490503
# Inspection after modification.
491504
's'
492505
],
506+
'pandas.core.series.Series.resample': ['df'],
493507
})
494508
self.assertEqual(result.failed, 0)
495509

@@ -668,10 +682,12 @@ def test_groupby_tests(self):
668682
'pandas.core.groupby.generic.DataFrameGroupBy.hist': ['*'],
669683
'pandas.core.groupby.generic.DataFrameGroupBy.fillna': [
670684
"df.fillna(method='ffill')",
685+
'df.fillna(method="ffill")',
671686
'df.fillna(value=values, limit=1)',
672687
],
673688
'pandas.core.groupby.generic.SeriesGroupBy.fillna': [
674689
"df.fillna(method='ffill')",
690+
'df.fillna(method="ffill")',
675691
'df.fillna(value=values, limit=1)',
676692
],
677693
},

0 commit comments

Comments
 (0)