Power up

Power Up is a game mechanic in Pokémon Go that allows the player to strengthen their Pokémon by increasing their CP level.

Powering Up or leveling up Pokémon involves two items, Stardust and Candy.

How to Power Up
From the Pokémon menu, select a Pokémon you wish to Power Up. If you have the required Candy and Stardust, simply tap Power Up to increase your Pokémon's CP level. Your resources will be consumed and your Pokémon's CP level will increase.

Stardust
Stardust is obtained by catching Pokemon or putting a Pokemon in a Gym and claiming its Defender Bonus.

Candy
Candy is a Pokémon specific item used to evolve your evolution-capable Pokémon. Evolving a Pokémon results in an immediate CP boost. At least one piece of Pokémon specific candy is also required for a basic CP Power Up.

Costs
The cost increase as each Pokémon level increases. The Stardust code is a good way to determine the Pokémon level since this value is hidden. Each power up increases the level of a Pokémon by 0.5.

The formula for Candy cost is the following:
 * $$CandyCost = \left \lfloor \frac{TrainerLevel - 1}{10} \right \rfloor + 1$$