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


Python DataArray.columns方法代码示例

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


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

示例1: TestReconcileModel

# 需要导入模块: from openamos.core.data_array import DataArray [as 别名]
# 或者: from openamos.core.data_array.DataArray import columns [as 别名]
class TestReconcileModel(unittest.TestCase):
    def setUp(self):
        self.data = genfromtxt("/home/kkonduri/simtravel/test/mag_zone/schedule_txt.csv", delimiter=",", dtype=int)
        colNames = [
            "houseid",
            "personid",
            "scheduleid",
            "activitytype",
            "locationid",
            "starttime",
            "endtime",
            "duration",
        ]
        self.actSchedules = DataArray(self.data, colNames)

    def test_retrieve_loop_ids(self):
        houseIdsCol = self.actSchedules.columns(["houseid"]).data
        houseIdsUnique = unique(houseIdsCol)
        print houseIdsUnique

        for hid in houseIdsUnique:
            schedulesRowsIndForHh = houseIdsCol == hid
            schedulesForHh = self.actSchedules.rowsof(schedulesRowsIndForHh)

            pIdsCol = schedulesForHh.columns(["personid"]).data
            pIdsUnique = unique(pIdsCol)

            for pid in pIdsUnique:
                schedulesRowIndForPer = pIdsCol == pid
                schedulesForPerson = schedulesForHh.rowsof(schedulesRowIndForPer)

                # print 'Raw schedules for hid:%s and pid:%s' %(hid, pid)
                # print schedulesForPerson

                activityList = []
                for sch in schedulesForPerson.data:
                    scheduleid = sch[2]
                    activitytype = sch[3]
                    locationid = sch[4]
                    starttime = sch[5]
                    endtime = sch[6]
                    duration = sch[7]

                    actepisode = ActivityEpisode(scheduleid, activitytype, locationid, starttime, endtime, duration)
                    activityList.append(actepisode)
                personObject = Person(hid, pid)
                personObject.add_and_reconcile_episodes(activityList)
开发者ID:osPlanning,项目名称:simtravel,代码行数:49,代码来源:child_dependency_processing.py

示例2: update_houseids

# 需要导入模块: from openamos.core.data_array import DataArray [as 别名]
# 或者: from openamos.core.data_array.DataArray import columns [as 别名]
    def update_houseids(self, hhldSyn, persSyn, hhldVars, persVars, highestHid):

	hhldSynDataObj = DataArray(hhldSyn, hhldVars)
        persSynDataObj = DataArray(persSyn, persVars)

	
	maxFreqCol = amax(hhldSynDataObj.columns(['frequency']).data)
	powFreqCol = floor(log(maxFreqCol, 10)) + 1

	coefficients = {'frequency':1, 'hhid':10**powFreqCol}

	newHid = hhldSynDataObj.calculate_equation(coefficients)
	hhldSynDataObj.setcolumn('hhid', newHid)

	newHid = persSynDataObj.calculate_equation(coefficients)
	persSynDataObj.setcolumn('hhid', newHid)


	hhldSynDataObj.sort([self.idSpec.hidName])
	persSynDataObj.sort([self.idSpec.hidName, self.idSpec.pidName])

	hidIndex_popgenH = hhldVars.index('hhid')
	hidIndex_popgenP = persVars.index('hhid')

        self.create_indices(persSynDataObj)

	hhldSyn = hhldSynDataObj.data
	persSyn = persSynDataObj.data

	row = 0
        for hhldIndex in self.hhldIndicesOfPersons:

            firstPersonRec = hhldIndex[1]
            lastPersonRec = hhldIndex[2]

	    #print hhldIndex[0], highestHid + 1, firstPersonRec, lastPersonRec

	    hhldSyn[row,hidIndex_popgenH] = highestHid + 1
	    persSyn[firstPersonRec:lastPersonRec,hidIndex_popgenP] = highestHid + 1

	    highestHid += 1
	    row += 1

	return hhldSyn, persSyn
开发者ID:foss-transportationmodeling,项目名称:simtravel,代码行数:46,代码来源:immigration.py


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