Returning Multiple Values:

Here we will discuss some ways to return multiple values from a function in python for data science.

  1. Using Object: In this, a class is there to hold multiple values and return an object of the class.python for data science
  2. Using Tuple: A comma-separatable item in a sequence is a Tuple. It can be created either by using or not using parenthesis. Tuples are immutable in nature.
  3. Using a List: It is similar to arrays, but it consists of square brackets. One more dissimilarity is that lists can contain different types of items. Lists are mutable in nature.

pst analytics python data science

  1. Using a Dictionary: As other languages have hash or map, similarly Python has dictionary.

To learn more about python for data science, you can check this and this as well.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.