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


Python Main.get_income方法代码示例

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


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

示例1: run

# 需要导入模块: import Main [as 别名]
# 或者: from Main import get_income [as 别名]
def run():
    """
    需要:
    gloV.LNG_MIN  gloV.LNG_MAX
    gloV.LAT_MIN  gloV.LAT_MAX
    gloV.gridId
    gloV.incomeList

    初始化赋值了:
    gloV.communityData
    gloV.communityValid

    gloV.communityIsVilla
    gloV.communityIsBefore2000

    gloV.communityGridId
    gloV.communitySummary

    修改了:
    gloV.communityOutput
    """

    # -------------------- Get communityDataAll --------------------
    # 运行 readDiskData() 之后拥有的变量:
    # gloV.communityVariableNameStr
    # gloV.communityVariableName
    # gloV.communityVariableNamePosition
    # gloV.communityOutput
    # gloV.communityDataAll
    noSave = readDiskData()
    if noSave == 'NO_SAVE.':
        return noSave

    gloV.communityData = []
    gloV.communityGridId = []
    gloV.communityValid = {}
    gloV.communityIsVilla = []
    gloV.communityIsBefore2000 = []
    for i in gloV.communityVariableName:
        gloV.communityValid[i] = []
    gloV.communityOutput[0].append('是否别墅')
    gloV.communityOutput[0].append('是否早于2000年竣工')
    gloV.communityOutput[0].append('Type')
    gloV.communityOutput[0].append('GridId')
    gloV.communityOutput[0].append('GenerateTime')

    for i in gloV.communityDataAll:
        if Main.is_valid(i[0]) and Main.is_valid(i[1]):
            if Main.is_right_city(i[0], i[1], gloV.communityVariableName, i, gloV.communityVariableNamePosition):
                tmpDataStr = []

                # 处理 gloV.communityData
                tmpData = []
                for j in range(0, len(i)):
                    tmpData.append(i[j])
                    tmpDataStr.append(str(i[j]))
                    if j == 2:
                        if Main.is_valid(i[j]) and Main.get_income(i[j]) != 0:
                            gloV.communityValid["区县"].append(Main.get_income(i[j]))
                    elif Main.is_valid(i[j]):
                        gloV.communityValid[gloV.communityVariableName[j]].append(i[j])
                gloV.communityData.append(tmpData)

                # 处理 gloV.communityGridId
                lngId = int((i[0] - gloV.LNG_MIN) / gloV.lngLeap)
                latId = int((i[1] - gloV.LAT_MIN) / gloV.latLeap)
                gloV.communityGridId.append(gloV.gridId[latId][lngId])

                # 处理 gloV.communityIsVilla
                villaVariableList = ['小区类型', '小区特点', '建筑类别', '建筑结构']
                villa = False
                for k in villaVariableList:
                    if k in gloV.communityVariableName and '别墅' in i[gloV.communityVariableNamePosition[k]]:
                        villa = True
                        break
                if villa:
                    gloV.communityIsVilla.append(1)
                    tmpDataStr.append('是')
                else:
                    gloV.communityIsVilla.append(0)
                    tmpDataStr.append('否')

                # 处理 gloV.communityIsBefore2000
                if '竣工时间' in gloV.communityVariableName:
                    tmpDate = i[gloV.communityVariableNamePosition['竣工时间']]
                    if Main.is_valid(tmpDate) and tmpDate.year < 2000:
                        gloV.communityIsBefore2000.append(1)
                        tmpDataStr.append('是')
                    else:
                        gloV.communityIsBefore2000.append(0)
                        tmpDataStr.append('否')
                else:
                    gloV.communityIsBefore2000.append(0)
                    tmpDataStr.append('否')

                # 处理 gloV.communityOutput
                tmpDataStr.append('社区')
                tmpDataStr.append(str(gloV.gridId[latId][lngId]))
                tmpDataStr.append(gloV.generateTime)
                gloV.communityOutput.append(tmpDataStr)
#.........这里部分代码省略.........
开发者ID:xyf031,项目名称:CXLocationSelect,代码行数:103,代码来源:Community.py

示例2: computeCommunity

# 需要导入模块: import Main [as 别名]
# 或者: from Main import get_income [as 别名]
def computeCommunity():
    """
    需要:
    gloV.communitySummary

    初始化赋值了:
    gloV.communityScore

    修改了:
    gloV.communityOutput
    """

    communityIncome = []
    communityRongjilv = []
    communityPrice = []
    communityFamily = []
    communityScoreTmp = []

    paraPaySum = gloV.paraPayIncome + gloV.paraPayPrice + gloV.paraPayRongjilv

    for i in range(0, len(gloV.communityData)):
        tmpData = gloV.communityData[i]

        # ---对4列参与计算的数据Zoom
        # 人均可支配收入
        if Main.is_valid(tmpData[2]) and Main.get_income(tmpData[2]) > 0:
            communityIncome.append(Main.zoom_data(Main.get_income(tmpData[2]), gloV.communitySummary[5][2], gloV.communitySummary[4][2]))
        else:
            communityIncome.append(0)

        # 容积率
        if Main.is_valid(tmpData[3]):
            communityRongjilv.append(Main.zoom_rongjilv(tmpData[3]))
        else:
            communityRongjilv.append(0)

        # 均价
        if Main.is_valid(tmpData[4]):
            communityPrice.append(Main.zoom_data(tmpData[4], gloV.communitySummary[5][4], gloV.communitySummary[4][4]))
        else:
            communityPrice.append(0)

        # 现有户数
        if Main.is_valid(tmpData[5]):
            communityFamily.append(Main.zoom_family(tmpData[5], gloV.communitySummary[5][5], gloV.communitySummary[4][5]))
        else:
            communityFamily.append(0)

        communityScoreTmp.append(gloV.paraCommunityPay *
                                 (gloV.paraPayIncome * communityIncome[i] +
                                  gloV.paraPayPrice * communityPrice[i] +
                                  gloV.paraPayRongjilv * communityRongjilv[i]) / paraPaySum +
                                 gloV.paraCommunityFamily * communityFamily[i])

    # ---计算社区评分
    gloV.communityScore = []
    gloV.communityOutput[0].append("Score")
    communityScoreMin = min(communityScoreTmp)
    communityScoreMax = max(communityScoreTmp)
    for i in range(0, len(communityScoreTmp)):
        gloV.communityScore.append(Main.zoom_data(communityScoreTmp[i], communityScoreMin, communityScoreMax))
        gloV.communityOutput[i + 1].append(str(Main.zoom_data(communityScoreTmp[i], communityScoreMin, communityScoreMax)))
开发者ID:xyf031,项目名称:CXLocationSelect,代码行数:64,代码来源:Community.py


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