Reputation: 995
In Python 3 and Pandas I have this dataframe:
te.info()
<class 'pandas.core.frame.DataFrame'>
Int64Index: 5541 entries, 0 to 5664
Data columns (total 13 columns):
DATA_LS 4118 non-null object
DATA_INCLUS 2957 non-null object
Proprietario 5541 non-null object
Nome_propriedade 5541 non-null object
Municipio 5525 non-null object
Estado 5533 non-null object
CNPJ_CPF_CEI 5541 non-null object
CNPJ_CPF_CEI_limpo 5541 non-null float64
Trab_Envolv 4529 non-null float64
Ramo_atividade 2840 non-null object
Localizacao 2734 non-null object
Cod_ativ 2975 non-null object
Tipo_lista 5541 non-null object
dtypes: float64(2), object(11)
memory usage: 606.0+ KB
Please, how can I create a new column in this dataframe with a copy of column "CNPJ_CPF_CEI_limpo"? With the same lines and data, but another name, such as "New_column_tests"
Upvotes: 1
Views: 14772
Reputation: 122
Inorder to add new column in the dataframe with the existing column data from same or different dataframe :
Dataframe_name['new_column_name'] = Dataframe_name['existing_column_name']
Upvotes: 3