Course Hive
Search

Welcome

Sign in or create your account

Continue with Google
or
Python tutorial: Basic Ingredients of a Python function
Play lesson

Python Tutorial: Learn Python For Data Science - Python tutorial: Basic Ingredients of a Python function

4.0 (1)
15 learners

What you'll learn

This course includes

  • 1.5 hours of video
  • Certificate of completion
  • Access on mobile and TV

Summary

Keywords

Full Transcript

Learn all about the basic ingredients of a function: https://www.datacamp.com/courses/python-data-science-toolbox-part-1 Congrats! So now you're able to write functions that accept multiple parameters and return multiple values, it is time to see how these learnt skills can be valuable in a Data Science context. In the following exercises, you'll write a function that analyzes a DataFrame of twitter data. The function that you'll write will return a dictionary containing data of how many times each language was used across all the tweets in the DataFrame. We'll see later in this course that we can generalize such a function to count occurences of any items in a DataFrame column. Let's recap the basic ingredients of a function: We have a function header which begins with the keyword def; this is followed by the function name, parameters in parentheses and a colon. We then have the function body, which contains docstrings enclosed in triple quotation marks; docstrings describe what the function does; the rest of the function body performs the computation that the function does; the function body closes with the keyword return, followed by the value or values returned by the function. That's it from me. Happy function-writing!

Course Hive

Continue this lesson in the app

Install CourseHive on Android or iOS to keep learning while you move.

Related Courses

FAQs

Course Hive
Download CourseHive
Keep learning anywhere