← Back to NumPy Course | Chapter 1: Getting Started | Lesson 3 of 7

NumPy इम्पोर्ट करना

Convention से हर कोई NumPy को short name np के नीचे import करता है, इसलिए code हर tutorial और project में same दिखता है।
Syntax
python
import numpy as np

NumPy Import करना

Standard import import numpy as np है। Alias np एक near-universal convention है जो code को short और readable रखता है। एक बार import होने पर, हर NumPy function np.something की तरह available है।

Note: from numpy import * से बचें; यह sum, min, और max जैसे built-ins overwrite करता है।

उदाहरण: Importing NumPy

python
import numpy as np

print("NumPy version is a string:", isinstance(np.__version__, str))
print("Pi from NumPy:", np.pi)
print("Square root of 16:", np.sqrt(16))

# Output:
# NumPy version is a string: True
# Pi from NumPy: 3.141592653589793
# Square root of 16: 4.0
Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the view already swaps in the hi_ translation fields (or blanks these out if untranslated), so this renders correctly for both languages without a lang_code check here. #}
आम गलतियां
  1. from numpy import * इस्तेमाल करना और Python built-ins shadow करना
  2. np से अलग एक alias इस्तेमाल करना और teammates को confuse करना
  3. np functions call करने से पहले import करना भूल जाना
चैप्टर सारांश
  • import numpy as np इस्तेमाल करें
  • np universal alias है
  • Star imports से बचें
  • install confirm करने के लिए np.__version__ check करें
🔒

Chapter Quiz — Complete all 7 topics to unlock

0/7 topics done

Complete these topics first:

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.