Triangle.py 文件源码

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

项目:chainladder-python 作者: jbogaardt 项目源码 文件源码
def data_as_triangle(self, inplace=False):
        """Method to convert tabular form to triangle form.

        Arguments:
            inplace: bool
                Set to True will update the instance data attribute inplace 

        Returns:
            Updated instance `data` parameter if inplace is set to True otherwise it returns a pandas.DataFrame
        """
        if self.dataform == 'tabular':
            tri = pivot_table(self.data, values=self.values, index=[
                              self.origin], columns=[self.dev]).sort_index()
            tri.columns = [str(item) for item in tri.columns]
            if inplace == True:
                self.data = tri
                self.dataform = 'triangle'
            return tri
        else:
            return self.data
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号