Featured post

Best Machine Learning Book for Beginners

You need a mixof different technologies for Data Science projects. Instead of learning many skills, just learn a few. The four main steps of any project are extracting the data, model development, artificial intelligence, and presentation. Attending interviews with many skills is not so easy. So keep the skills short.
A person with many skills can't perform all the work. You had better learn a few skills like Python, MATLAB, Tableau, and RDBMS. So that you can get a job quickly in the data-science project.
Out of Data Science skills, Machine learning is a new concept. Why because you can learn Python, like any other language. Tableau also the same. Here is the area that needs your 60% effort is Machine learning.  Machine Learning best book to start.

Related Posts How to write multiple IF-conditions in Python Simplified

Python 'getsizeof' Return Value a Quick Example

In Python, we use objects like List (arrays). You already know that Objects have some data. Counting the number of elements present in it is not easy. You may ask a question on how to get the size.

Do not worry, I am sharing the command for you.

How to Import the Library?

>>> import sys

Sys library is the library you need to import to use the SIZE commands.

Congrats for you since you have now imported the SYS library. The command name is getsizeof.


Check the below example.

print("An Integer:")

 i = int(100) 

print(sys.getsizeof(i))


The result will be: 100

If I want to say more about the size command, it is length like command. It gives the result based on the object. Suppose, if you use Strings, you will get String length.

Python Command to get the Size of an Object


Best Example of SIZE command.

Example:1

print("Empty string:") 

empty_string = "" 

print(sys.getsizeof(empty_string)) 


Example:2

print("A normal string") 

s = "Hello world" 

print(sys.getsizeof(s))


Example:3

 print("Increasing string:") 

for i in range(0,5): 

     empty_string = empty_string + chr(i) 

     print(sys.getsizeof(empty_string))


Related Posts

Comments

Popular posts from this blog

Hyperledger Fabric: 20 Real Interview Questions

Best Machine Learning Book for Beginners

Python Assigning Multiple Values at Once