Need to apply only z rotation?

Is there a way to apply only specified axis or rotation ?

I think this needs to be scripted,

Rotate in editmode

I’ve not done any scripting before. I would think this is a common problem but I guess not.

Any advice on the scripting ?