Ravindra Bagale · Data Scienceसर्व coursesया course चे lessonsशोधाEnglish

Data Science · मराठी आवृत्ती

9.2 Rename, strip आणि standardise

रवींद्र बागले यांच्या course वर आधारित · सहज मराठीत explanation

Raw data ची copy करा. Column names मधले बाहेरचे spaces काढा, lowercase करा आणि मधल्या spaces ऐवजी underscore वापरा. City आणि status मधले spaces व case देखील एकसारखे करूया.

df = raw.copy()
df.columns = (
    df.columns.str.strip().str.lower().str.replace(" ", "_")
)
df["city"] = df["city"].str.strip().str.title()
df["status"] = df["status"].str.strip().str.title()

Pune आणि pune वेगळे groups बनू नयेत म्हणून हा step उपयोगी आहे. raw मूळ स्वरूपात राहतो; बदल df मध्ये होतात.