Remove it! Onions that do this don't store well so should be used first after lifting.
Or leave it and you will have your own onion seeds.
As said below, this is your onion going to seed
Due to the previous cold weather with the sudden hot turn, onions are found to be 'Bolting'
Pinch them off or all of the goodness will go to the seed rather than the bulb itself
This has happened to many of mine too. Also some stems/leaves are thickening!
The stems thicken when they get too much feed or water
They are still fine for eating but will be significantly marked down if showing
I've nipped the flower head off but should I take out the whole stalk?
Donna yes cut it off, on the slant, as low down as you can go.
I had a couple also, but they were chopped off as soon as I saw them, Onions are still doing well through.