This paper studies the estimation of a panel data model with latent structures where individuals can be classified into different groups with the slope parameters being homogeneous within the same group but heterogeneous across groups. To identify the unknown group structure of vector parameters, we design an algorithm called Panel-CARDS. We show that it can identify the true group structure asymptotically and estimate the model parameters consistently at the same time. Simulations evaluate the performance and corroborate the asymptotic theory in several practical design settings. The empirical application reveals the heterogeneous grouping effect of income on democracy.