<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def to_frequencies(self, fill=np.nan):
 """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 -------- array([[0.75, 0.25, 0. ], [0.25, 0.5 , 0.25], [0. , 0. , 1. ]]) """


        an = np.sum(self, axis=1)[:, None]
        with ignore_invalid():
            af = np.where(an > 0, self / an, fill)

        return af