import pandas as pd from wordcloud import WordCloud import wordcloud cars_df = pd.read_csv("car_prices.csv") cars_df = cars_df.drop(["title", "link"], axis=1) cars_df = cars_df[cars_df["fuel"] != "LPG"] cars_df = cars_df[cars_df["vol_engine"] > 500] cars_df = cars_df[cars_df["price"] < 2_500_000] cars_df = cars_df[cars_df["year"] > 1990] cars_df["vol_engine"] = cars_df["vol_engine"] / 1000 cars_df.loc[cars_df["year"] == 2023, "year"] = 2022 cars_df["mark"] = cars_df["mark"].apply(lambda x: x.capitalize()) cars_df.loc[cars_df["mark"]=="Mercedes-benz"] = "MercedesBenz" cars_df.loc[cars_df["mark"]=="Alfa-romeo"] = "AlfaRomeo" WordCloud ( background_color = 'white', width = 512, height = 250, collocations=False ).generate_from_text(' '.join(cars_df["mark"])).to_file('assets/wordcloud.png')