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!
