Skip to content

Commit d90b978

Browse files
committed
#55 Fixed the pandas append issue
1 parent 26f70a7 commit d90b978

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

exasol_udf_mock_python/mock_context.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -212,20 +212,18 @@ def get_dataframe(self, num_rows='all', start_col=0):
212212
columns_ = [column.name for column in self._metadata.input_columns[start_col:]]
213213

214214
i = 0
215-
df = None
215+
dfs: list[pd.DataFrame] = []
216216
while num_rows == 'all' or i < num_rows:
217-
df_current = pd.DataFrame.from_records(
218-
[self._data[start_col:]], columns=columns_)
219-
if df is None:
220-
df = df_current
221-
else:
222-
df = df.append(df_current)
217+
dfs.append(pd.DataFrame.from_records(
218+
[self._data[start_col:]], columns=columns_))
223219
if not self.next():
224220
break
225221
i += 1
226-
if df is not None:
227-
df = df.reset_index(drop=True)
228-
return df
222+
if dfs:
223+
df = pd.concat(dfs, ignore_index=True)
224+
df.reset_index(inplace=True, drop=True)
225+
return df
226+
return None
229227

230228
def __getattr__(self, name):
231229
return None if self._data is None else self._data[self._name_position_map[name]]

0 commit comments

Comments
 (0)