FAQ: The Data Science Process - Explore the Data

This community-built FAQ covers the “Explore the Data” exercise from the lesson “The Data Science Process”.

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

Code Foundations

FAQs on the exercise Explore the Data

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!

for the Barplot, what is the arg inside the bracket of:

plt.close()
sns.barplot(
data=new_df,
x= “location”,
y= “age”
)
plt.show()
What is the argument inside the bracket of this Barplot exercise. I try many things such as “age”, “location” etc.
and come up with errors everytime.

I may be mistaking your issue and apologies if that’s the case but you can hunt down the valid parameters for this function in the seaborn docs:
https://seaborn.pydata.org/generated/seaborn.barplot.html
The same page has some usage examples if you scroll down a little.

Dear Sir,

You have helped tremendously.

Thank you.

HC Ma

TigerT via Codecademy Forums <[email protected]> 於 2021年7月27日 週二 上午2:17寫道:

1 Like

Newbie here, and from the amount of information, it seems I will be a newbie for a long time.

I have seen lots of code snippets that leave a space after a variable name, for example, x = 4
But other statements have the equal sign without the space, for example, x=4

My question is, does having a spacing between these symbols have any impact on the code? Does it mean the same? Is there any instance where you should have spacing or not?

Appreciate it in advance! Thank you

I can’t think of any situation where this would affect the code. It’s really more of a style thing, your typical assignment example would look like x = 4. Your might skip the whitespaces when using a keyword argument in a function call or when writing default parameters in a function definition-

x = 4
def func(par1=5, par2=10):  # defaults typically skip whitespace around operator
    result = par1 + par2
    return result

func(x, par2=20)  # keyword arguments also normally drop the whitespace

When it comes to style there is no accepted answer. If you’re looking for generic guidance then Python’s own suggestion is to use PEP8-

You may find others use different style guidance or they have no style at all :wink:, in larger established projects everyone should follow the same rules regardless of your personal preference. But PEP8 is a great place to start.

2 Likes

I see… Yeah, my head was spinning because in some instances I saw the space, in others I didn’t. With more time, it will make more sense. Thanks for your response! :slight_smile:

1 Like

I have a question about the graphs in this exercise. The standard deviation for seaborn.barplot for urban is different than for violinplot. Why does barplot for urban shows small standard deviation and violinplot shows larger? Shouldnt it be that the standard deviation for barplot fir urban is also large?

1 Like

Every time I copy and paste the code, I get this message. Also, the charts are not showing up on the side.

The line above where age is defined is currently commented out. You’d need to correctly assign that name before you can use it (uncomment the bit with the assignment).

okay, every time i enter the bar plot code, I get a syntax error on line 29 of the code.

File “script.py”, line 29
y= “age”
^
SyntaxError: invalid syntax

For reverence, this is the code section that it is referencing.
plt.close()
sns.barplot(
data=new_df,
x= “location”,
y= “age”
)
plt.show()

not sure what to make of it as my typed in example in script.py looks exactly the same as the codebyte in the exercise, but I get the syntax error no matter what I do to try fixing it

I would also appreciate more details regarding the silver lines/rectangles in both the bar and violin graphs.