We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 788ccc4 commit 1a8071aCopy full SHA for 1a8071a
pandas/_testing/__init__.py
@@ -89,7 +89,10 @@
89
assert_timedelta_array_equal,
90
raise_assert_detail,
91
)
92
-from pandas._testing.compat import get_dtype # noqa:F401
+from pandas._testing.compat import ( # noqa:F401
93
+ get_dtype,
94
+ get_obj,
95
+)
96
from pandas._testing.contexts import ( # noqa:F401
97
RNGContext,
98
decompress_file,
pandas/_testing/compat.py
@@ -11,3 +11,13 @@ def get_dtype(obj):
11
return obj.dtypes.iat[0]
12
else:
13
return obj.dtype
14
+
15
16
+def get_obj(df: DataFrame, klass):
17
+ """
18
+ For sharing tests using frame_or_series, either return the DataFrame
19
+ unchanged or return it's first column as a Series.
20
21
+ if klass is DataFrame:
22
+ return df
23
+ return df._ixs(0, axis=1)
0 commit comments