My daughter did the same thing except she would get down on all fours and bang her head on the floor. They best way to get her to stop, is
A. Distract her, instead of telling her "no" point her in anouther direction and thus you will avoid her getting upset, instead of telling her to "stop it" when she is doing somthing that is wrong, distract her with somthing else or just explain to her why she shouldn't be doing what it is you don't want her to do, then ask her if she wants to read a book or have some milk or play a game. Even though she is only one explaining things to her is good even though she may not know everything you are saying, because it's your tone of voice rather than the words, and eventually she will catch on. I always use the word no for only emergencies only, that way it's more effective.
B. Let her bang her head and don't make a big deal about it, don't say no or she will do it more just to get a reaction from you, distract her (see above). Unless she is going to hurt herself then step in, otherwise ignore it and act like it never happend.
Your daughter will grow out of this (quicker if you ignore it) My daughter only did it for a couple of months and has not done it since, she started around a year, she is 20 months now and has not done it since then, it will pass.