me explique este codigo: 
import numpy as np
  import math

  files_list = dbutils.fs.ls(f'/mnt/{mount_name}/Brazil/{table_path}') 
  table_size = 0
  list_partition_sizes = [] 
  partition_size_mb = 0

  for file in files_list: 
    partition_path = file.path 
    partition_size = 0 

    if partition_path[-1] == '/': 
      partition_size = sum(NAME_1.size for NAME_1 in dbutils.fs.ls(partition_path)) 

      partition_size_mb = round(partition_size/1024/1024 ,2)
      optimal_nb_files_inpartition = math.ceil(partition_size_mb/120) 

      if optimal_nb_files_inpartition > 1: 
  #       print('=============================================') 
  #       print(f'- Partition name: {file.name}') 
  #       print(f'- Partition size: {partition_size_mb} MB') 
  #       print(f'- Optimal number of files in partition: {optimal_nb_files_inpartition}') 
  #       print('=============================================') 

        list_partition_sizes.append(optimal_nb_files_inpartition) 

      table_size = table_size + partition_size_mb

  if list_partition_sizes:
    print(f'Some partitions need {max(list_partition_sizes)} files per partition')
    print(f'Before write your dataframe use: df = df.repartition({max(list_partition_sizes)},(partition_key))')
  #   print(list_partition_sizes)
  else:
    print('All partitions can be repartitioned to 1')
    print('Before write your dataframe use: df = df.repartition(1,(partition_key))')
    
  print(f'Total table size: {round(table_size/1024, 2)} GB') if table_size > 1000 else print