当前位置: 首页>>代码示例>>Python>>正文


Python ETLUtils.add_transpose_list_column方法代码示例

本文整理汇总了Python中etl.ETLUtils.add_transpose_list_column方法的典型用法代码示例。如果您正苦于以下问题:Python ETLUtils.add_transpose_list_column方法的具体用法?Python ETLUtils.add_transpose_list_column怎么用?Python ETLUtils.add_transpose_list_column使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在etl.ETLUtils的用法示例。


在下文中一共展示了ETLUtils.add_transpose_list_column方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_categories

# 需要导入模块: from etl import ETLUtils [as 别名]
# 或者: from etl.ETLUtils import add_transpose_list_column [as 别名]
def get_categories(file_path):
    records = ETLUtils.load_json_file(file_path)

    # Now we obtain the categories for all the businesses
    records = ETLUtils.add_transpose_list_column('categories', records)
    BusinessETL.drop_unwanted_fields(records)

    return records[0].keys()
开发者ID:anuragreddygv323,项目名称:yelp,代码行数:10,代码来源:business_clusterer.py

示例2: create_category_matrix

# 需要导入模块: from etl import ETLUtils [as 别名]
# 或者: from etl.ETLUtils import add_transpose_list_column [as 别名]
    def create_category_matrix(file_path):
        """
        Creates a matrix with all the categories for businesses that are
        contained in the Yelp Phoenix Business data set. Each column of the
        matrix represents a category, and each row a business. This is a binary
        matrix that contains a 1 at the position i,j if the business i contains
        the category j, and a 0 otherwise.

        :rtype : numpy array matrix
        :param file_path: the path for the file that contains the businesses
        data
        :return: a numpy array binary matrix
        """
        records = ETLUtils.load_json_file(file_path)

        # Now we obtain the categories for all the businesses
        records = ETLUtils.add_transpose_list_column('categories', records)
        BusinessETL.drop_unwanted_fields(records)
        matrix = numpy.array(
            [numpy.array(record.values()) for record in records])

        return matrix
开发者ID:antoine-tran,项目名称:yelp,代码行数:24,代码来源:business_etl.py


注:本文中的etl.ETLUtils.add_transpose_list_column方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。