Skip to content

Commit

Permalink
#55 Fixed the pandas append issue
Browse files Browse the repository at this point in the history
  • Loading branch information
ahsimb committed Oct 22, 2024
1 parent 26f70a7 commit d90b978
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions exasol_udf_mock_python/mock_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,20 +212,18 @@ def get_dataframe(self, num_rows='all', start_col=0):
columns_ = [column.name for column in self._metadata.input_columns[start_col:]]

i = 0
df = None
dfs: list[pd.DataFrame] = []
while num_rows == 'all' or i < num_rows:
df_current = pd.DataFrame.from_records(
[self._data[start_col:]], columns=columns_)
if df is None:
df = df_current
else:
df = df.append(df_current)
dfs.append(pd.DataFrame.from_records(
[self._data[start_col:]], columns=columns_))
if not self.next():
break
i += 1
if df is not None:
df = df.reset_index(drop=True)
return df
if dfs:
df = pd.concat(dfs, ignore_index=True)
df.reset_index(inplace=True, drop=True)
return df
return None

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

0 comments on commit d90b978

Please sign in to comment.