Skip to content
Advertisement

How to combine two entry values in a column

In the dataset, the column “Erf Size” has entries like 1 733 and 1 539 etc. Note that the Dtype of this “Erf Size” column is object.

I would like to join these 1 733 and 1 539 into 1733 and 1539 etc. original dataset

expected output

Advertisement

Answer

I think you can fix this with pd.to_numeric. This will change the data type to a number value and I expect it to remove the space.

Or else you can try:

df1['Erf Size'].str.strip()

that will remove the space, which will work in your dataset as it’s an object.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement