FAQ: Project: Board Slides for FoodWheel - Orders Over Time

This community-built FAQ covers the “Orders Over Time” exercise from the lesson “Project: Board Slides for FoodWheel”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Data Science

FAQs on the exercise Orders Over Time

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

Hi. I am confused about when we need to use a lambda function. I became confused on Step 3 of this exercise after viewing the hint, which didn’t include the lambda function. I tried to do:

orders[‘month’] = orders.date.split(’-’)[0]

When that didn’t work, I tried variations of:

orders[‘month’] = orders.apply(orders.date.split(’-’)[0])

I finally requested the solution and saw that a lambda function was required. Is there any other way to solve this without a lambda function? If not, what is a good way to determine when lambda functions will be needed? I have struggled with this throughout the lessons. Thank you.

1 Like

Me too. I’m also confused about when to use lambda. The hints could be better. So could the replies on these forums. I see you asked a month ago already.

This is what worked for me

orders['month'] = orders.apply(lambda x: x['date'].split('-')[0],axis=1)

One needs lambda for more complicated operations using python. I wrote this as a separate function to start with then integrated it into the single line of code. The "axis=1’ makes the code work along the row instead of the column

In this lesson you can find answer https://www.codecademy.com/courses/practical-data-cleaning/lessons/pandas-data-cleaning/exercises/splitting-char?action=resume_content_item