df = df.withColumnRenamed("D1C","cod_regiao") \
.withColumnRenamed("D1N", "regiao")\
.withColumnRenamed("D2C","cod_variavel") \
.withColumnRenamed("D2N", "variavel") \
.withColumnRenamed("D3C", "ano_codigo") \
.withColumnRenamed("D3N","ano") \
.withColumnRenamed("D4C", "doenca_codigo") \
.withColumnRenamed("D4N","tipo_doenca") \
.withColumnRenamed("MC", "medida") \
.withColumnRenamed("MN", "unidade") \
.withColumnRenamed("NC","cod_nivel_territorial") \
.withColumnRenamed("NN", "nivel territorial") \
.withColumnRenamed("V","valor")
E
df_new = df.withColumn("cod_regiao", col("cod_regiao").cast(IntegerType())) \
.withColumn("cod_variavel", col("cod_variavel").cast(IntegerType())) \
.withColumn("ano_codigo", col("ano_codigo").cast(IntegerType())) \
.withColumn("ano", col("ano").cast(IntegerType())) \
.withColumn("doenca_codigo", col("doenca_codigo").cast(IntegerType())) \
.withColumn("medida", col("medida").cast(IntegerType())) \
.withColumn("cod_nivel_territorial", col("cod_nivel_territorial").cast(IntegerType())) \
.withColumn("valor", col("valor").cast(IntegerType()))