Then I used the proportions_ztest method imported from  statsmodels.stats.proportion   which could output the z statistics and p value after inputing the counts and total numbers of two samples as follows where value means the difference between the proportions and alternative means if I want to apply a two-sided test or one-sided one.
stat, pval = proportions_ztest(counts, nobs,value=0, alternative='larger')