Skip to content

Commit

Permalink
adds kwargs
Browse files Browse the repository at this point in the history
  • Loading branch information
BWMac committed Sep 4, 2024
1 parent e33a0f2 commit 6a0b3c3
Showing 1 changed file with 10 additions and 17 deletions.
27 changes: 10 additions & 17 deletions synapseclient/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,7 @@ def _csv_to_pandas_df(
list_columns=None,
rowIdAndVersionInIndex=True,
dtype=None,
na_values=None,
keep_default_na=True,
**kwargs,
):
"""
Convert a csv file to a pandas dataframe
Expand All @@ -424,9 +423,9 @@ def _csv_to_pandas_df(
list_columns: The names of the list columns in the file
rowIdAndVersionInIndex: Whether the file contains rowId and version in the index, Defaults to `True`.
dtype: The data type for the file, Defaults to `None`.
na_values: The values to be considered as NA/NaN, Defaults to `None`.
The list of defaults for Pandas can be found here: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_csv.html
keep_default_na: Whether to keep the default NaN values when parsing the file, Defaults to `True`.
**kwargs: Additional keyword arguments to pass to pandas.read_csv. See
https://pandas.pydata.org/docs/reference/api/pandas.read_csv.html
for complete list of supported arguments.
Returns:
A pandas dataframe
Expand All @@ -449,8 +448,7 @@ def _csv_to_pandas_df(
escapechar=escape_char,
header=0 if contain_headers else None,
skiprows=lines_to_skip,
na_values=na_values,
keep_default_na=keep_default_na,
**kwargs,
)
# parse date columns if exists
if date_columns:
Expand Down Expand Up @@ -2471,11 +2469,7 @@ def _update_self(self, syn):
return self

def asDataFrame(
self,
rowIdAndVersionInIndex=True,
convert_to_datetime=False,
na_values=None,
keep_default_na=True,
self, rowIdAndVersionInIndex=True, convert_to_datetime=False, **kwargs
):
"""Convert query result to a Pandas DataFrame.
Expand All @@ -2484,9 +2478,9 @@ def asDataFrame(
(and row_etag if it exists)
convert_to_datetime: If set to True, will convert all Synapse DATE columns from UNIX timestamp
integers into UTC datetime objects
na_values: A list of strings to recognize as NA/NaN.
keep_default_na: Whether to include the default NaN values.
https://pandas.pydata.org/docs/reference/api/pandas.read_csv.html
kwargs: Additional keyword arguments to pass to pandas.read_csv. See
https://pandas.pydata.org/docs/reference/api/pandas.read_csv.html
for complete list of supported arguments.
Returns:
A Pandas dataframe with results
Expand Down Expand Up @@ -2525,8 +2519,7 @@ def asDataFrame(
list_columns=list_columns,
rowIdAndVersionInIndex=rowIdAndVersionInIndex,
dtype=dtype,
na_values=na_values,
keep_default_na=keep_default_na,
**kwargs,
)

except pd.errors.ParserError:
Expand Down

0 comments on commit 6a0b3c3

Please sign in to comment.