Pardon my relative inexperience in Python, but this problem has kept me stuck for some time now:
I have a dataframe, df1 like this:
ID Hourly Rate Category
0 8900 2.99 Car
1 9904 9.99 Car
2 6381 19.99 Bike
3 5862 2.99 Bike
4 2270 2.99 Car
(0-4 are just row numbers). Now I want to make df2 in such a way that this data of column Category will be changed as per following condition:
if Category is Car: C if Category is Bike: B (There can be other categories as well)
i.e. df2 would be as follows:
ID Hourly Rate Category
0 8900 2.99 C
1 9904 9.99 C
2 6381 19.99 B
3 5862 2.99 B
4 2270 2.99 C
I have used a pretty trivial approach to use the if conditions within the function, but want to do it using Lambda Function.