def domain_user_stats():
    # type: () -> pd.Series
    """ Get number of distinct email addresses in observed domains

    TODO: get up to date with new projects layout
    How to build email_domain_users.csv:

    from collections import defaultdict
    import logging
    from common import utils as common
    import stscraper as scraper

    log = logging.getLogger("domain_user_stats")
    stats = defaultdict(set)
    for ecosystem in common.ECOSYSTEMS:
        urls = common.package_urls(ecosystem)
        for package_name, url in urls.items():
            log.info(package_name)
            try:
                cs = scraper.commits(url)
            except scraper.RepoDoesNotExist:
                continue
            for email_addr in cs["author_email"].dropna().unique():
                if not email_addr or pd.isnull(email_addr):
                    continue
                try:
                    user, email_domain = clean(email_addr).split("@")
                except InvalidEmail:
                    continue
                stats[email_domain].add(user)
    s = pd.Series({dm: len(users) for dm, users in stats.items()})
    s = s.rename("users").sort_values(ascending=False)
    s.to_csv("common/email_domain_users.csv", encoding="utf8", header=True)
    return s
    """
    fname = os.path.join(os.path.dirname(__file__), "email_domain_users.csv")
    stats = pd.read_csv(fname, header=0, squeeze=True, index_col=0)
    return stats[pd.notnull(stats.index)]