The Group number and period number corresponds to the outer most shell and number of electrons present in outer most shell.
For Example:
Oxygen has atomic number 8, and its electronic configurations is,
1s², 2s², 2pₓ², 2py¹, 2pz¹
The outermost shell is 2, means oxygen is present in period 2, and the number of electrons in n = 2 are 6, so the group number is 6 in periodic table.
Lets take another example of Sodium, it has atomic number 11 with electronic configuration;
1s², 2s², 2p⁶, 3s¹
The outermost shell is 3, means sodium is present in period 3, and the number of electrons in n = 3 are 1, so the group number is 1 in periodic table.