Questions tagged [o-d-matrix]
19 questions
8
votes
2 answers
Creating origin-destination matrices with R
My data frame consists of individuals and the city they live at a point in time. I would like to generate one origin-destination matrix for each year, which records the number of moves from one city to another. I would like to know:
How can I…

goclem
- 904
- 1
- 10
- 21
5
votes
1 answer
Google Distance Matrix API: How to specify origin-destination pairs?
I am using the Python client library for Google Maps API (Github link).
I would like to get the duration_in_traffic figures for the following trips:
Address1 to Address2
Address2 to Address1
Address1 to Address3
Address3 to Address1
But the syntax…

Crickets
- 524
- 1
- 8
- 23
2
votes
0 answers
Strange “Exception Unknown” Error - Alternatives to OD matrix from QNEAT3? Possible graph failure with OSM data?
I have previously posted this but I've been running into a hard to understand problem using QGIS's QNEAT3 Plugin. I've contacted the creator of the plugin and he was unsure of the problem too. I'm attempting to run it using 10 points generated at…

StupidQuestionGuy
- 191
- 1
- 7
1
vote
1 answer
TypeError: ('invalid cache item: tuple') in XGBoost
I am trying to get classify value using XGBoost model.
However I got an Error when I declared XGBoost model.
How can I fix this error ?
train = pd.read_csv("./data/train.csv")
test_x = pd.read_csv("./data/test.csv")
train_y = train['Y']
train_x =…

Takumi Mukaiyama
- 21
- 2
1
vote
0 answers
Converting new dataset into a previous patsy dmatrix form
I have divided my data set into 2 sets, training and test set. I have 6 types of dummy variable in my data. Every time I try to run the model on my training set I get error.
This is my code:
X = dmatrix('sfdc_tier + poc_image + sub_segment +…

Roshni Jain
- 11
- 1
1
vote
1 answer
Create origin-Destination matrix from a Data Frame in Python
I would like to create an origin-destination matrix from the following data frame in python:
Origin Destination
1 2
1 3
1 4
2 3
3 4
I expect the following matrix:
1 2 3 4
1 0 1 1 1
2 0 0 1 0…

bahar
- 67
- 2
- 6
1
vote
1 answer
Convert (origin, destination, distance) to a distance matrix
I have a matrix with three columns (origin, destination, distance) and I want to convert this to a origin/destination matrix with Pandas, is there a fast way (lambda, map) to do this without for loops?
For example (what I have):
a b 10
a c 20
b c…

Nima
- 55
- 8
1
vote
1 answer
Count origin-destination relationships (without direct) with R
I have a origin-destination table like this.
library(dplyr)
set.seed(1983)
namevec <- c('Portugal', 'Romania', 'Nigeria', 'Peru', 'Texas', 'New Jersey', 'Colorado', 'Minnesota')
## Create OD pairs
df <- data_frame(origins = sample(namevec, size =…

Chia Hsin Liu
- 13
- 3
1
vote
1 answer
Computing origin-destination fixed effects with R
I am using a gravity equation with various types of fixed-effects. Origin fixed-effect, destination fixed-effect, and origin-destination pair fixed-effect.
Consider the following example
require(dplyr)
mydf <- data_frame(orig = rep(LETTERS[1:3],…

goclem
- 904
- 1
- 10
- 21
1
vote
0 answers
Modeling SAR origin-destination flows?
I would like to model SAR Origin-Destination (migration) flows using [the
model specification proposed by LeSage & Pace] (http://www4.fe.uc.pt/spatial/doc/lecture7.pdf) (p.8, equation [10]):
Where o stands for origin and d for destination.
I think…

chamaoskurumi
- 2,271
- 2
- 23
- 30
0
votes
0 answers
OD MATRIX for street network using QNEAT3 in QGIS give wrong output
enter image description here I'm trying to use QNEAT3 in QGIS for computing shortest path for my network, but the result is not accurate .I checked the graph and everything is fine but the problem is it didn't detect disconnected nodes! And it show…

sohaah
- 1
0
votes
1 answer
Is there a possibility to merge several origin destination matrices into one dataframe?
I have created origin destination matrices for different weeks in the year, e.g. the output looks like:
Region 1
Region 2
Region 3
Region 1
0
8
1
Region 2
4
3
3
Region 3
2
2
3
Week 1
I have similar looking matrices for all weeks of…

Britt Min
- 3
- 1
0
votes
0 answers
DMatrix in MultiOutput XGBoost Regressor
I am trying to convert a hyperparameter tuning algorithm to a MultiOutput regression setup, can someone please help me create DMatrix for the same. Here is the code for reference:
def modelfit(alg, dtrain, predictors, useTrainCV=True, cv_folds=5,…

Nikita Agrawal
- 51
- 7
0
votes
1 answer
How to create an OD matrix from a pandas Data Frame only with specific columns
I have this data frame as in the picture below. I need to create an Origin-Destination matrix wherein the Row axis I will have the date as a column and the values from the "From municipality code", On the Columns axis I will have the values of the …

Elda
- 49
- 1
- 10
0
votes
0 answers
Origin Destination Data - Reshaping / Ordering / Path Replication
I have origin-destination data which is not ordered and want to deduct a path from it. Therefore I want to add an order column which contains the number of the "steps".
Following data table should contain the path of…

Zappageck
- 122
- 9