map_camps_timehistory.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:Visualflee 作者: cspgdds 项目源码 文件源码
def get_loctype(location, date_index):
    """Returns a pandas Series of the location type for each day.

    Locations with a changetime have type *city* before that day, and *conflict*
    after it.
    """
    n_days = len(date_index)
    changetime = location.time
    if pd.isnull(changetime):
        loctype = location.location_type
    else:
        #0:changetime, loctype = "city"
        loctype = ['city'] * int(changetime)
        #changetime:-1, loctype = "conflict"
        loctype +=['conflict'] * int(n_days - changetime)
    return pd.Series(loctype, index=date_index)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号