code: def to_frequencies(self, fill=np.nan):
          
  
          an = np.sum(self, axis=1)[:, None]
          with ignore_invalid():
              af = np.where(an > 0, self / an, fill)
  
          return af
docs: Compute allele frequencies.
  
          Parameters
          ----------
          fill : float, optional
              Value to use when number of allele calls is 0.
  
          Returns
          -------
          af : ndarray, float, shape (n_variants, n_alleles)
  
          Examples
          --------
  
          >>> import allel
          >>> g = allel.GenotypeArray([[[0, 0], [0, 1]],
          ...                          [[0, 2], [1, 1]],
          ...                          [[2, 2], [-1, -1]]])
          >>> ac = g.count_alleles()
          >>> ac.to_frequencies()
          array([[0.75, 0.25, 0.  ],
                 [0.25, 0.5 , 0.25],
                 [0.  , 0.  , 1.  ]])