1

I need to inner-join 2 dataframes: routes and sources. Joining should be on routes.source=sources.row number. And I don't see how to do it (in Python/Pandas you'd just do right_index=True). I've checked the DataFrames.jl doc, and can't see how to join on row number. Nor I could convert row number into another column.

Routes:

Routes, source number in column "source"

Sources:

Sources, source number is row number

culebrón
  • 34,265
  • 20
  • 72
  • 110

1 Answers1

2

A DataFrame does not have a row index, unlike e.g. a pandas DataFrame.

If you want to join on the row number, you can just create it as a column:

sources.row_num = 1:nrow(sources)

and then

innerjoin(routes, sources, on = :source => :row_num)

to perform an inner join where the source column of routes and the row_num column of sources are used to perform the join.

Nils Gudat
  • 13,222
  • 3
  • 39
  • 60