Skip to main content

Python basics -binary , numpy array

 # prompt: give a sample program for learning NumPy



import numpy as np

# Create a 1D array
arr1 = np.array([1, 2, 3, 4, 5])
print("1D Array:", arr1)

# Create a 2D array
arr2 = np.array([[1, 2, 3], [4, 5, 6]])
print("2D Array:\n", arr2)

# Accessing elements
print("First element of arr1:", arr1[0])
print("Element at row 1, column 2 of arr2:", arr2[1, 2])

# Array shape
print("Shape of arr2:", arr2.shape)

# Array data type
print("Data type of arr1:", arr1.dtype)

# Array operations
arr3 = np.array([10, 20, 30,40,50])
print("Sum of arr1 and arr3:", arr1 + arr3)
print("Product of arr1 and 3:", arr1 * 3)

# Array slicing
print("First two elements of arr1:", arr1[:2])
print("Elements from index 1 to 3 of arr1:", arr1[1:4])

# Reshaping arrays
arr4 = np.arange(12).reshape(4, 3)
print("Reshaped array:\n", arr4)




0s
1D Array: [1 2 3 4 5]
2D Array:
 [[1 2 3]
 [4 5 6]]
First element of arr1: 1
Element at row 1, column 2 of arr2: 6
Shape of arr2: (2, 3)
Data type of arr1: int64
Sum of arr1 and arr3: [11 22 33 44 55]
Product of arr1 and 3: [ 3  6  9 12 15]
First two elements of arr1: [1 2]
Elements from index 1 to 3 of arr1: [2 3 4]
Reshaped array:
 [[ 0  1  2]
 [ 3  4  5]
 [ 6  7  8]
 [ 9 10 11]]

Comments

Popular posts from this blog

Telecom OSS and BSS: A Comprehensive Guide

  Telecom OSS and BSS: A Comprehensive Guide Table of Contents Part I: Foundations of Telecom Operations Chapter 1: Introduction to Telecommunications Networks A Brief History of Telecommunications Network Architectures: From PSTN to 5G Key Network Elements and Protocols Chapter 2: Understanding OSS and BSS Defining OSS and BSS The Role of OSS in Network Management The Role of BSS in Business Operations The Interdependence of OSS and BSS Chapter 3: The Telecom Business Landscape Service Providers and Their Business Models The Evolving Customer Experience Regulatory and Compliance Considerations The Impact of Digital Transformation Part II: Operations Support Systems (OSS) Chapter 4: Network Inventory Management (NIM) The Importance of Accurate Inventory NIM Systems and Their Functionality Data Modeling and Management Automation and Reconciliation Chapter 5: Fault Management (FM) Detecting and Isolating Network Faults FM Systems and Alerting Mecha...

AI Agents for Enterprise Leaders -Next Era of Organizational Transformation

  AI Agents for Enterprise Leaders: Charting a Course into the Next Era of Organizational Transformation Introduction AI agents and multiagent AI systems represent more than just technological advancements. They signify a fundamental shift in how organizations can automate processes, improve human-machine collaboration, generate insights, and respond dynamically to complex challenges. These systems offer the potential to unlock significant value across a wide range of functions—from enhancing customer interactions and optimizing supply chains to driving innovation in product development and service delivery. Realizing the Benefits To realize these benefits, organizations must engage in deliberate planning, make strategic investments, and foster a culture of continuous improvement and technological advancement. By aligning AI agent initiatives with core business goals, investing in the right infrastructure, and nurturing a culture of innovation, enterprises can position themselves t...

Airport twin basic requirements

  1. 3D Model of  New Terminal Arrivals Area: Develop a high-fidelity 3D model of the New Terminal Arrivals Area using provided LiDAR/CAD data and images. Include key elements like baggage carousels, immigration counters, customs checkpoints, and waiting areas. 2. Real-time Passenger Flow Monitoring: Integrate with Xovis and CCTV systems to track passenger movement in real-time. Visualize passenger flow on the 3D model, highlighting congestion areas and potential bottlenecks. Display real-time passenger count and density information on dashboards. 3. Baggage Handling Visualization: Integrate with the baggage handling system to track baggage movement in real-time. Visualize baggage flow on the 3D model, showing baggage movement from aircraft to carousels. Display real-time baggage status and potential delays on dashboards. 4. Security Monitoring: Integrate with CCTV feeds to monitor the Arrivals Area for suspicious activities. Implement AI-powered video analytics f...