Functions in Python Programming for Data Science

by | Jan 3, 2021 | Python | 0 comments

I am really impressed with two online courses one is “Analytics in Python” at edX by ColombiaX and another is “Python for Data Science” at cognitiveclass.ai or (Previously Bigdatauniversity). So i am going to document what ever i will learn about functions in these two courses.

First there are Built-in functions(Ready made for use), such as help() to ask for help, min() to get the minimum value, print() to print an object to the terminal.

x=5
y=7
z=max(x,y) #max is the function. x and y are the arguments
print(z) #print is the function. z is the argument

You can find an overview with more of these functions here.

Built-in Functions
abs()dict()help()min()setattr()
all()dir()hex()next()slice()
any()divmod()id()object()sorted()
ascii()enumerate()input()oct()staticmethod()
bin()eval()int()open()str()
bool()exec()isinstance()ord()sum()
bytearray()filter()issubclass()pow()super()
bytes()float()iter()print()tuple()
callable()format()len()property()type()
chr()frozenset()list()range()vars()
classmethod()getattr()locals()repr()zip()
compile()globals()map()reversed()__import__()
complex()hasattr()max()round()
delattr()hash()memoryview()set()

 

User-Defined Functions (UDFs), which are functions that users create to help them out; And

You can define functions to provide the required functionality. Here are simple rules to define a function in Python.

  • Functions blocks begin def followed by the function nameand parentheses ().
  • There are input parameters or arguments should be placed within these parentheses.
  • You can also define parameters inside these parentheses.
  • There is a body within every function starts with a colon (:) and is indented.
  • You can also place documentation before the body
  • The statement “return” exits a function, optionally passing back a value

or sometimes don’t return anything

If no return statement, python returns None

def iamlost():
print(‘Yes I am lost in Python World’)
print(‘Are you too’)
h=9
iamlost()

output:-

Yes I am lost in Python World
Are you too

This is the Best Video on Functions in Python i have come across :-

Join Today

Know more about latest trends, News in Field of Data Analytics.

We will offer Free SAS and Python Programme in Data Science & enhance your understanding of data analysis.

By rlochan2021

We offer Everything Free here and always will be, so joining is Risk Free and Always Cost Free.

Check Out These Related Posts

String Functions in SAS and Python

I always believe SAS and Python can make a great team together for Data Scientists. So Why Now we study them together. In this Post we will discuss various String functions in SAS and Python. String Functions in Python 3 Hope you must have gone through my previous post “Python Programming- Strings explained“. len(): returns […]

read more

Types in Python Explained- Built-in Data types

Next chapter to ‘My First Python Program and Introduction to Jupyter Notebooks’ is ‘Types in Python’. I am following The course in “Python For Data Science” at cognitiveclass.ai and these Posts are way of me documenting what i have learnt. Built-in Data types Python Programming/Data Types – Wikibooks is one good read that you must not miss. You can also […]

read more

0 Comments

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *