├── CommonTransforms ├── CommonTransforms.py └── README.md ├── LICENSE └── README.md /CommonTransforms/CommonTransforms.py: -------------------------------------------------------------------------------- 1 | # Databricks notebook source 2 | from pyspark.sql.functions import trim,when,isnull,lit,col,from_utc_timestamp,to_utc_timestamp,concat_ws,sha1,length,substring,lit,concat,date_add,expr,year,datediff 3 | from pyspark.sql import functions as F 4 | import datetime 5 | 6 | # COMMAND ---------- 7 | 8 | class CommonTransforms: 9 | inputDf=None 10 | inputSchema=None 11 | inputColums=None 12 | 13 | # Constructor 14 | def __init__(self, input): 15 | self.inputDf=input 16 | self.inputSchema=self.inputDf.schema 17 | self.inputColumns=self.inputDf.schema.fieldNames() 18 | 19 | # Remove Leading and Trailing Spaces 20 | def trim(self): 21 | stringCol= (col for col in self.inputSchema if str(col.dataType)=="StringType") 22 | for col in stringCol: 23 | self.inputDf = self.inputDf.withColumn(col.name,trim(col.name)) 24 | return self.inputDf 25 | 26 | # Replace Null values with Default values based on datatypes 27 | def replaceNull(self,value, subset=None): 28 | isDate=False 29 | isTimestamp =False 30 | 31 | try: 32 | if isinstance(value, str): 33 | date_obj = datetime.datetime.strptime(value, "%Y-%m-%d") #YYYY-MM-DD format e.g "2020-10-01" 34 | isDate= True 35 | except ValueError: 36 | isDate=False 37 | 38 | try: 39 | if isinstance(value, str): 40 | date_obj = datetime.datetime.strptime(value, "%Y-%m-%dT%H:%M:%S") #YYYY-MM-DDThh:mm:ss format e.g "2020-10-01T19:50:06" 41 | isTimestamp= True 42 | except ValueError: 43 | isTimestamp=False 44 | 45 | if isDate and subset is not None: 46 | dateCol = (x for x in self.inputSchema if str(x.dataType)=="DateType" and x.nullable==True and x.name in subset) 47 | for x in dateCol: 48 | self.inputDf = self.inputDf.withColumn(x.name, when(isnull(col(x.name)),lit(value)).otherwise(col(x.name))) 49 | elif isDate and subset is None: 50 | dateCol = (x for x in self.inputSchema if str(x.dataType)=="DateType" and x.nullable==True) 51 | for x in dateCol: 52 | self.inputDf = self.inputDf.withColumn(x.name, when(isnull(col(x.name)),lit(value)).otherwise(col(x.name))) 53 | elif isTimestamp and subset is not None: 54 | tsCol = (x for x in self.inputSchema if str(x.dataType)=="TimestampType" and x.nullable==True and x.name in subset) 55 | for x in tsCol: 56 | self.inputDf = self.inputDf.withColumn(x.name, when(isnull(col(x.name)),lit(value)).otherwise(col(x.name))) 57 | elif isTimestamp and subset is None: 58 | tsCol = (x for x in self.inputSchema if str(x.dataType)=="TimestampType" and x.nullable==True) 59 | for x in tsCol: 60 | self.inputDf = self.inputDf.withColumn(x.name, when(isnull(col(x.name)),lit(value)).otherwise(col(x.name))) 61 | else: 62 | self.inputDf = self.inputDf.fillna(value,subset) 63 | 64 | return self.inputDf 65 | 66 | # Remove duplicates 67 | def deDuplicate(self, subset=None): 68 | self.inputDf = self.inputDf.dropDuplicates(subset) 69 | return self.inputDf 70 | 71 | # Convert UTC timestamp to local 72 | def utc_to_local(self,localTimeZone,subset=None): 73 | if subset is not None: 74 | tsCol = (x for x in self.inputSchema if str(x.dataType)=="TimestampType" and x.name in subset) 75 | else: 76 | tsCol = (x for x in self.inputSchema if str(x.dataType)=="TimestampType") 77 | 78 | for x in tsCol: 79 | self.inputDf = self.inputDf.withColumn(x.name,from_utc_timestamp(col(x.name),localTimeZone)) 80 | return self.inputDf 81 | 82 | # Convert timestamp in local timezone to UTC 83 | def local_to_utc(self,localTimeZone,subset=None): 84 | if subset is not None: 85 | tsCol = (x for x in self.inputSchema if str(x.dataType)=="TimestampType" and x.name in subset) 86 | else: 87 | tsCol = (x for x in self.inputSchema if str(x.dataType)=="TimestampType") 88 | 89 | for x in tsCol: 90 | self.inputDf = self.inputDf.withColumn(x.name,to_utc_timestamp(col(x.name),localTimeZone)) 91 | return self.inputDf 92 | 93 | # Change Timezone 94 | def changeTimezone(self,fromTimezone,toTimezone,subset=None): 95 | if subset is not None: 96 | tsCol = (x for x in self.inputSchema if str(x.dataType)=="TimestampType" and x.name in subset) 97 | else: 98 | tsCol = (x for x in self.inputSchema if str(x.dataType)=="TimestampType") 99 | 100 | for x in tsCol: 101 | self.inputDf = self.inputDf.withColumn(x.name,to_utc_timestamp(col(x.name),fromTimezone)) 102 | self.inputDf = self.inputDf.withColumn(x.name,from_utc_timestamp(col(x.name),toTimezone)) 103 | return self.inputDf 104 | 105 | # Drop System/Non-Business Columns 106 | def dropSysColumns(self,columns): 107 | self.inputDf = self.inputDf.drop(columns) 108 | return self.inputDf 109 | 110 | # Create Checksum Column 111 | def addChecksumCol(self,colName): 112 | self.inputDf = self.inputDf.withColumn(colName,sha1(concat_ws("~~", *self.inputDf.columns))) 113 | return self.inputDf 114 | 115 | # Convert Julian Date to Calendar Date 116 | def julian_to_calendar(self,subset): 117 | julCol = (x for x in self.inputSchema if str(x.dataType)=="IntegerType" and x.name in subset) 118 | for x in julCol: 119 | self.inputDf = (self.inputDf.withColumn(x.name,col(x.name).cast("string")) 120 | .withColumn(x.name+"_year", 121 | when((length(col(x.name))==5) & (substring(col(x.name),1,2) <=50),concat(lit('20'),substring(col(x.name),1,2))) 122 | .when((length(col(x.name))==5) & (substring(col(x.name),1,2) >50),concat(lit('19'),substring(col(x.name),1,2))) 123 | .when(length(col(x.name))==7,substring(col(x.name),1,4)) 124 | .otherwise(lit(0)) 125 | ) 126 | .withColumn(x.name+"_days", 127 | when(length(col(x.name))==5,substring(col(x.name),3,3).cast("int")) 128 | .when(length(col(x.name))==7,substring(col(x.name),5,3).cast("int")) 129 | .otherwise(lit(0)) 130 | ) 131 | .withColumn(x.name+"_ref_year",concat(col(x.name+"_year"),lit("-01"),lit("-01")).cast("date")) 132 | .withColumn(x.name+"_calendar",expr("date_add(" + x.name+"_ref_year"+","+ x.name+"_days)-1")) 133 | .drop(x.name, x.name+"_year",x.name+"_days",x.name+"_ref_year") 134 | .withColumnRenamed(x.name+"_calendar",x.name) 135 | 136 | ) 137 | return self.inputDf 138 | 139 | # Convert Calendar Date to Julian Date 140 | def calendar_to_julian(self, subset): 141 | calCol = (x for x in self.inputSchema if ((str(x.dataType)=="DateType" or str(x.dataType)=="TimestampType") and x.name in subset)) 142 | 143 | for x in calCol: 144 | self.inputDf = (self.inputDf.withColumn(x.name+"_ref_year", concat(year(col(x.name)).cast("string"),lit("-01"),lit("-01"))) 145 | .withColumn(x.name+"_datediff", datediff(col(x.name),col(x.name+"_ref_year"))+1) 146 | .withColumn(x.name+"_julian", concat(substring(year(col(x.name)).cast("string"),3,2),col(x.name+"_datediff")).cast("int")) 147 | .drop(x.name,x.name+"_ref_year",x.name+"_datediff") 148 | .withColumnRenamed(x.name+"_julian",x.name) 149 | ) 150 | return self.inputDf 151 | 152 | # Add a set of literal value columns to dataframe, pass as dictionary parameter 153 | def addLitCols(self,colDict): 154 | for x in colDict.items(): 155 | self.inputDf = self.inputDf.withColumn(x[0],lit(x[1])) 156 | return self.inputDf 157 | -------------------------------------------------------------------------------- /CommonTransforms/README.md: -------------------------------------------------------------------------------- 1 | # CommonTransforms 2 | 3 | CommonTransforms is a Python class that uses PySpark libraries to apply common transformations to a Spark dataframe. 4 | 5 | ## Getting Started 6 | Use %run magic command to include this notebook. The %run magic command will work equally well for Synapse Spark Pool and Databricks 7 | ```python 8 | %run "//CommonTransforms" 9 | ``` 10 | Then instantiate the class by passing the dataframe 11 | ```python 12 | df = spark.read.csv(path) 13 | ct = CommonTransforms(df) 14 | ``` 15 | 16 | ## Function Reference 17 | CommonTransforms supports the following functions: 18 | 19 | ### 1. trim 20 | Removes leading and trailing spaces from all string columns in the dataframe 21 | 22 | * **Parameters:** None 23 | 24 | * **Usage:** 25 | ```python 26 | df = ct.trim() 27 | ``` 28 | ### 2. replaceNull 29 | Replace null values in dataframe with a default value. The default value is applied to all columns or a subset of columns passed as a list. The default value could be numeric, string, date, timestamp, boolean or dictionary object. When dictionary object is passed, custom default values can be applied to specified columns. The default value is only applied to the columns of same data type. For e.g. if the default value is a string only the string columns which are null are replaced and the numeric columns are untouched. 30 | 31 | * **Parameters:** 32 | * value - int, long, float, string, bool date, timestamp or dict. Value to replace null values with. If the value is a dict, then subset is ignored and value must be a mapping from column name (string) to replacement value. The replacement value must be an int, long, float, boolean, or string. 33 | * subset – optional list of column names to consider. Columns specified in subset that do not have matching data type are ignored. For example, if value is a string, and subset contains a non-string column, then the non-string column is simply ignored. 34 | 35 | * **Usage:** 36 | ```python 37 | df = ct.replaceNull(0) 38 | ``` 39 | ```python 40 | df = ct.replaceNull("NA") 41 | ``` 42 | 43 | ```python 44 | df = ct.replaceNull("1900-01-01T00:00:00","start_datetime") 45 | df = ct.replaceNull("9999-12-31T23:59:59","end_datetime") 46 | ``` 47 | 48 | ```python 49 | df = ct.ct.replaceNull({"passenger_count":1,"store_and_fwd_flag":"N","tip_amount":0}) 50 | ``` 51 | ### 3. deDuplicate 52 | Delete duplicate records from dataframe with option to consider a subset of key columns. 53 | 54 | * **Parameters:** 55 | * subset - optional list of column names to consider. 56 | 57 | * **Usage:** 58 | ```python 59 | df = ct.deDuplicate() 60 | ``` 61 | 62 | ```python 63 | df = ct.deDuplicate(["col1","col2"]) 64 | ``` 65 | ### 4. utc_to_local 66 | Convert all or a subset of timestamp columns from UTC to timestamp in local timezone 67 | 68 | * **Parameters:** 69 | * localTimeZone - your target timezone specified as Country/City. Here is the list of [timezones](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). 70 | * subset - optional list of column names to consider. 71 | 72 | * **Usage:** 73 | ```python 74 | df = ct.utc_to_local("Australia/Sydney") 75 | ``` 76 | ```python 77 | df = ct.utc_to_local("Australia/Sydney",["pickup_datetime","dropoff_datetime"]) 78 | ``` 79 | ### 5. local_to_utc 80 | Convert all or a subset of timestamp columns from local timezone to UTC 81 | 82 | * **Parameters:** 83 | * localTimeZone - your source timezone specified as Country/City. Here is the list of [timezones](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). 84 | * subset - optional list of column names to consider. 85 | 86 | * **Usage:** 87 | ```python 88 | df = ct.local_to_utc("Australia/Sydney") 89 | ``` 90 | ```python 91 | df = ct.utc_to_local("Australia/Sydney",["recorded_datetime"]) 92 | ``` 93 | ### 6. changeTimezone 94 | Converts all or selected timestamps in dataframe from one timezone to another. 95 | 96 | * **Parameters:** 97 | * fromTimezone - specified as Country/City. Here is the list of [timezones](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). 98 | * toTimezone - specified as Country/City 99 | 100 | * **Usage:** 101 | ```python 102 | df = ct.changeTimezone("Australia/Sydney","America/New_York") 103 | ``` 104 | ### 7. dropSysColumns 105 | Drop columns that are either system or non-business from dataframe 106 | 107 | * **Parameters:** 108 | * columns - list of columns to be dropped 109 | 110 | * **Usage:** 111 | ```python 112 | df = ct.dropSysColumns(["col1","col2"]) 113 | ``` 114 | ### 8. addChecksumCol 115 | Create a checksum column using all columns of the dataframe 116 | 117 | * **Parameters:** 118 | * colName - Name of the new checksum column 119 | 120 | * **Usage:** 121 | ```python 122 | df = ct.addChecksumCol("checksum") 123 | ``` 124 | ### 9. julian_to_calendar 125 | Converts a 5-digit or 7-digit Julian date to a calendar date 126 | 127 | * **Parameters:** 128 | * subset - a mandatory list of columns that contain a Julian date value 129 | 130 | * **Usage:** 131 | ```python 132 | df = df.withColumn("sys_date1",lit(20275)) #Date in Julian Format 133 | df = ct.julian_to_calendar("sys_date1") 134 | # Output=2020-10-01 135 | ``` 136 | 137 | ### 10. calendar_to_julian 138 | Converts a calendar date to 5-digit Julian date 139 | 140 | * **Parameters:** 141 | * subset - a mandatory list of columns that contain a date 142 | 143 | * **Usage:** 144 | ```python 145 | df = df.withColumn("sys_date2",lit("2020-10-01").cast("date")) #Date in Gregorian Format 146 | df = ct.calendar_to_julian("sys_date2") 147 | # Output=20275 148 | ``` 149 | 150 | ### 11. addLitCols 151 | Add a set of literal value columns to dataframe passed as dictionary parameter. For e.g adding audit columns to a dataframe 152 | 153 | * **Parameters:** 154 | * colDict - a mandatory dict object that contains key(column) and values. 155 | 156 | * **Usage:** 157 | ```python 158 | audit={"audit_key":66363, 159 | "pipeline_id":"56f633", 160 | "start_datetime": "2020-10-01T10:00:00", 161 | "end_datetime": "2020-10-01T10:02:05"} 162 | df = ct.addLitCols(audit) 163 | ``` 164 | ## Implementation References 165 | * **[Microsoft Fabric data platform using ELT Framework](https://github.com/bennyaustin/fabric-dataplatform)** 166 | * **[Azure Databricks data platform using ELT Framework](https://github.com/bennyaustin/synapse-dataplatform)** 167 | * **[Azure Synapse data platform using ELT Framework](https://github.com/bennyaustin/synapse-dataplatform)** 168 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # pyspark-utils 2 | This repo has a collection of reusable Python classes that extend out of box PySpark capabilities. This collection has the following classes. 3 | 4 | ## 1. CommonTransforms 5 | CommonTransforms is a Python class that uses PySpark libraries to apply common transformations to a Spark dataframe. More information about this class and it's usage is available here - [CommonTransforms/README.md](../main/CommonTransforms/README.md) 6 | --------------------------------------------------------------------------------