Change the shape of an object's rim?

So basically, I deleted the top face of the cilinder and want to change the rim in to the shape of an octagon. Right now, its a circle and when I change it, I don’t want the whole shape to be affected… only the rim’s edge loop. Thanks for any help.

when you create the cylinder you could create it in an octogon shape. – might be easier to work backwards, then subdivide the object and smooth the lower part so that that it round and the top in an octogon.

Thanks, that really helped.