Help required for drawing a chart

I’ve the below table of data:

2×7 DataFrame
│ Row │ Customer │ M0      │ M1       │ M2    │ M3    │ ...   │ Mn    │
│     │ String   │ Int64   │ Int64    │ Int64 │ Int64 │ Int64 │ Int64 │
├─────┼──────────┼─────────┼──────────┼───────┼───────┼───────┼───────┤
│ 1   │ x        │ 8       │ 7        │ 9     │ 2     │ .     │ 3     │
│ 2   │ y        │ 6       │ 3        │ 4     │ 2     │ .     │ 7     │

That is generted from the below:

using CSV, Query, DataFrames
df = CSV.read("deliveries.csv"; header=true, delim=',')

deliveries = by(
    sdf -> mapcols(sum, sdf[:, 3:end]),
    df, 
    :Customer
)
println(deliveries)

I’m trying to use using Gadfly any other option is ok for me, to draw the chart, so that each row (customer) is a series, so I’ll be having a multiple time serials lines.

There’s this example in the Gadfly docs:
http://gadflyjl.org/dev/man/plotting/#Wide-formatted-data-1

Thanks,
It worked with me as:

using Gadfly

data = stack(deliveries, [:M0, :M1, :M2, :M3, .... :Mn])

plot(data, x=:Customer, y=:value, color=:variable, Geom.line)

Is there a way to avoid writting this long line:

data = stack(deliveries, [:M0, :M1, :M2, :M3, .... :Mn])
using DataFrames
?stack

Note the help string contains both stack and melt. Also see the DataFrames docs

Thanks, I got it as:

data = stack(deliveries, 2:60)

Any idea why I could not get it as:

data = stack(deliveries, 2:end)
?end

I think end only works when used inside brackets.
Did you try:

melt(deliveries, 1)
2 Likes

Thanks a lot, got it done by this