df = spark.sql(f"select * from DependentDataset")

ds = df.toPandas().iloc[:-1]

spark.createDataFrame(ds.astype(str)).createOrReplaceTempView('BaseCode_NA')

ds.head()



Also skip top and bottom from the Dependent dataset


dfBase = spark.sql("select * from DependentDataset")

dsBase = dfBase.toPandas().iloc[1:].iloc[:-1]

sparkds = spark.createDataFrame(dsBase.astype(str))

sparkds.createOrReplaceTempView("BaseCode_GL")

sparkds.show()