Featured Post

14 Top Data Pipeline Key Terms Explained

Image
 Here are some key terms commonly used in data pipelines 1. Data Sources Definition: Points where data originates (e.g., databases, APIs, files, IoT devices). Examples: Relational databases (PostgreSQL, MySQL), APIs, cloud storage (S3), streaming data (Kafka), and on-premise systems. 2. Data Ingestion Definition: The process of importing or collecting raw data from various sources into a system for processing or storage. Methods: Batch ingestion, real-time/streaming ingestion. 3. Data Transformation Definition: Modifying, cleaning, or enriching data to make it usable for analysis or storage. Examples: Data cleaning (removing duplicates, fixing missing values). Data enrichment (joining with other data sources). ETL (Extract, Transform, Load). ELT (Extract, Load, Transform). 4. Data Storage Definition: Locations where data is stored after ingestion and transformation. Types: Data Lakes: Store raw, unstructured, or semi-structured data (e.g., S3, Azure Data Lake). Data Warehous...

Python 'getsizeof' Command the Real Purpose

Here's a sample python program to get the size of a List array.  Getting the number of elements present in a List is not easy. So how to get this? To do you need the 'getsizeof' command.

Import 'sys' Library.

You need to import the 'sys' library to use the SIZE commands. 

>>> import sys

Congrats to 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

What is the size command?  - is to get the size of elements. It gives the result based on the object you are being used. Suppose, if you use Strings, you will get String length.

Python Command to get the Size of an Object


How to use the 'getsizeof' 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))

Sources

Comments

Popular posts from this blog

How to Fix datetime Import Error in Python Quickly

SQL Query: 3 Methods for Calculating Cumulative SUM

Big Data: Top Cloud Computing Interview Questions (1 of 4)