Skip to content

Commit 6f5b9cc

Browse files
committed
chore: deprecate select_columns
1 parent cdec202 commit 6f5b9cc

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

python/datafusion/dataframe.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ def schema(self) -> pa.Schema:
9797
"""
9898
return self.df.schema()
9999

100+
@deprecated(
101+
"select_columns() is deprecated. Use :py:meth:`~DataFrame.select` instead"
102+
)
100103
def select_columns(self, *args: str) -> DataFrame:
101104
"""Filter the DataFrame by columns.
102105

python/tests/test_dataframe.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,30 +103,28 @@ def partitioned_df():
103103

104104

105105
def test_select(df):
106-
df = df.select(
106+
df_1 = df.select(
107107
column("a") + column("b"),
108108
column("a") - column("b"),
109109
)
110110

111111
# execute and collect the first (and only) batch
112-
result = df.collect()[0]
112+
result = df_1.collect()[0]
113113

114114
assert result.column(0) == pa.array([5, 7, 9])
115115
assert result.column(1) == pa.array([-3, -3, -3])
116116

117-
118-
def test_select_mixed_expr_string(df):
119-
df = df.select_columns(column("b"), "a")
117+
df_2 = df.select("b", "a")
120118

121119
# execute and collect the first (and only) batch
122-
result = df.collect()[0]
120+
result = df_2.collect()[0]
123121

124122
assert result.column(0) == pa.array([4, 5, 6])
125123
assert result.column(1) == pa.array([1, 2, 3])
126124

127125

128-
def test_select_columns(df):
129-
df = df.select_columns("b", "a")
126+
def test_select_mixed_expr_string(df):
127+
df = df.select(column("b"), "a")
130128

131129
# execute and collect the first (and only) batch
132130
result = df.collect()[0]

0 commit comments

Comments
 (0)