Bin behaviour in fit( Histogram, (x,y) ) |> Plots.heatmap

Hi,
I would to ask for your support with this one.

I am fitting an 2d-histrogram to a tuple of vectors. Then, I try to heatmap it but I cannot make it work. Interestingly, for random data it works as it should. I cannot use histogram2d() cause I want to manipulate(filter) the 2d-histogram before plotting it.

My code:

df=CSV.read("path")
mybins=100
x=Vector(df[!,:A])
y=Vector(df[!,:B])
lenx=length(x) # equal to 2265
leny=length(y) # equal to 2265

h1=fit(Histogram,(x,y),closed=:left,nbins=mybins)
h1=normalize(h1,mode=:pdf)
p1=heatmap(h1.edges[1],h1.edges[2],h1.weights)

I obtain

Length of x & y does not match the size of z.
Must be either `size(z) == (length(y), length(x))` (x & y define midpoints)
or `size(z) == (length(y)+1, length(x)+1))` (x & y define edges).
error(::String) at error.jl:33

But then

h2=fit(Histogram,(rand(lenx),rand(leny)),closed=:left,nbins=mybins)
h2=normalize(h2,mode=:pdf)
p2=heatmap(h2.edges[1],h2.edges[2],h2.weights)

myimage

My question: what am I missing?

Thank you

Are you sure the data read by CSV.read is right?

It is right, it is just a toy example.

Thank you