I have a dataframe with the part numbers associated with specific auto vehicles. I am trying to use a for loop to break the larger dataframe (with all vehicles in it) into smaller dataframes for each vehicle. My main issue is that I need to reference the vehicle names and place them in the name for their respective dataframe. For example, I need all Altima parts numbers to be in a dataframe called df2020 Altima
I am using the below code to accomplish this
df4_vehicle_list = df4['Model_Name'].unique()
df4_vehicle_list
This code returns: array(['2020 Maxima', '2020 Altima', '2020 Leaf', '2019 Altima', '2020(.5) Rogue', '2020 JX', '2021 Murano', '2019 Pathfinder', '2020 Pathfinder', '2021 Rogue'], dtype=object)
Then I try to use the below code
for i in df4_vehicle_list:
name = df4['Model_Name'] == i
df[i] = df4[name]