I'm new to pandas. I have the following dataframe:

| ID | A | B |
| --- | --- | --- |
| 0 | Data | Data |
| 1 | Data | Data |
| 2 | Data | Data |
| 3 | Data | Data |
| 3 | Data | Data |
| 3 | Data | Data |
| 3 | Data | Data |

I want to replicate every row 3 times for a group with a size < 3. The dataframe will look like this:

| ID | A | B |
| --- | --- | --- |
| 0 | Data | Data |
| 0 | Data | Data |
| 0 | Data | Data |
| 1 | Data | Data |
| 1 | Data | Data |
| 1 | Data | Data |
| 2 | Data | Data |
| 2 | Data | Data |
| 2 | Data | Data |
| 3 | Data | Data |
| 3 | Data | Data |
| 3 | Data | Data |
| 3 | Data | Data |

Does anyone have ideas? Thanks in advance.