Skip to content

Commit

Permalink
updating to latest version
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-mrojas committed Apr 5, 2024
1 parent 2908e85 commit 9d9819b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
this_directory = Path(__file__).parent
long_description = (this_directory / "README.md").read_text()

VERSION = '0.0.37'
VERSION = '0.0.38'

setup(name='snowpark_extensions',
version=VERSION,
Expand All @@ -14,7 +14,7 @@
long_description_content_type='text/markdown',
url='http://github.com/MobilizeNet/snowpark-extensions-py',
author='mauricio.rojas',
install_requires=['snowflake-snowpark-python[pandas]==1.11.1','jinja2'],
install_requires=['snowflake-snowpark-python[pandas]==1.14.0','jinja2'],
author_email='[email protected]',
packages=['snowpark_extensions'],
zip_safe=False)
13 changes: 0 additions & 13 deletions snowpark_extensions/dataframe_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,19 +231,6 @@ def group_by_pivot(self,pivot_col):
return GroupByPivot(self, pivot_col)
RelationalGroupedDataFrame.pivot = group_by_pivot

RelationalGroupedDataFrame._applyInPandas = RelationalGroupedDataFrame.apply_in_pandas

def applyInPandas(self,func,schema=None,output_schema=None,**kwargs):
output_schema = output_schema or schema
input_columns = [x.name for x in self._df.schema.fields]
def func_wrapper(pdf):
pdf.columns = input_columns
return func(pdf)
if isinstance(output_schema, str):
output_schema = schema_str_to_schema(output_schema)
return self._applyInPandas(func_wrapper,output_schema=output_schema,**kwargs)

RelationalGroupedDataFrame.applyInPandas = applyInPandas
###### HELPER END


12 changes: 11 additions & 1 deletion snowpark_extensions/types_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,14 @@ def schema__get_item__(self,index):
else:
return self.fields[index]
StructType.__getitem__ = schema__get_item__
StructField.dtype = property(lambda self: self.datatype)
StructField.dtype = property(lambda self: self.datatype)
from snowflake.snowpark._internal.type_utils import convert_sf_to_sp_type
def fromJson(cls, json: dict) -> StructField:
return StructField(
json["name"],
convert_sf_to_sp_type(json["type"]),
json.get("nullable", True),
json.get("metadata"),
)
StructField.fromJson = fromJson
StructType.fromJson = lambda cls,json: StructType([StructField.fromJson(f) for f in json["fields"]])

0 comments on commit 9d9819b

Please sign in to comment.