Foodwheel

Question about foodwheel jupyter notebooks:

I am trying to make the new column for orders based on splitting the date column. Nothing works. When I use I use a lambda function to make the month, it doesn’t crash but adding the column is problematic.
month = lambda x: len(x[“date”].split(’-’)[0])
orders.assign([‘month’])
orders.head(10)

It’s telling me that assign gets 1 positional argument and I’ve provided 2 (which clearly I have not - and the same thing happens when I use month without single quotes and brackets. If I leave assign empty, nothing happens at all. Do you have a hint? All the normal online resources are silent on this (or I haven’t dug up the answer yet.)

Is this exercise related? Which exercise is this? Also from the beta? Please share url so we can at least find the right course

1 Like

This is the optional foodwheel jupyter notebook exercise at the end of Unit 2
https://www.codecademy.com/programs/1e882de199eeb8554098552d40ea9681/items/d9314a347e5727fd3fd68923c7be52ec
Sorry not to be more clear about it. I understand it’s optional but I wanted to do it anyway.

2 Likes

So, its a complete different section then the topic you hijacked (see guidelines)

I haven’t done that course yet, and installing jupyter is not working, i have conflicting packages. I would have to resolve that. This is why you should start a new topic, so that the person best suited to help you can help you. Let me see what i can do

many people on the forum helping on the forum do not have a subscription to pro-intens, isn’t there a option to ask fellow students questions? More likely to get a better answer

this can’t be all the code? Now its very difficult to replicate the problem

1 Like

There are slack channels and such set up for those programs, aren’t there?

We here on the forum are essentially just random people on the internet. We’re not involved in that.

So you might want to be asking in those other places.

That said, you’re welcome to ask things here. Just keep in mind that we can’t see that content so any question has to be self-contained… And also no promises that we know anything about what you’re doing. I’d wildly guess there are pandas data structures involved here.

2 Likes

I am sorry. I was simply trying to find help for this problem . I didn’t mean to “hijack” anything. It is not clear where one gets help with the exercises in the data science program. Other Codecademy courses have a button at the bottom of the exercise pages where one can join or start a thread.

I’ll keep trying elsewhere, or maybe I’ll just skip the ones I can’t do for now, as this was (as I mentioned) an optional exercise.

I didn’t… mention hijacking D: nevermind that.
Point is just that if you have any expectations, we’re not it.

Python implicitly adds the object itself as the first argument, so the method will receive two arguments when calling it this way. When it says that it only takes one, it means it takes none, just a reference to the object itself.

class Person:
    def greet(self, greetee):  # <- two received
        return 'hello ' + greetee

p = Person()
p.greet('bob')  # <- one argument sent

Again with the guessing,
https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.assign.html#pandas-dataframe-assign
I have absolutely no clue if orders is a pandas DataFrame or not, but if it is, then assign’s signature is DataFrame.assign(**kwargs) which means it only accepts keyword arguments
That might already ring a bell, otherwise there’s an example at that link.

1 Like