concatenate() से Arrays जोड़ना
concatenate() आपके चुने axis के साथ arrays को end to end जोड़ता है।
In this page:
Syntax
np.concatenate((arr1, arr2), axis=0)
concatenate()
np.concatenate arrays का एक tuple लेता है और इन्हें एक existing axis के साथ जोड़ता है। Arrays को हर दूसरी dimension में match होना चाहिए। axis=0 rows stack करता है, axis=1 columns add करता है।
Note:
axis=None जोड़ने से पहले सब कुछ flatten करता है।
उदाहरण: concatenate()
import numpy as np
a = np.array([[1, 2], [3, 4]])
b = np.array([[5, 6]])
print(np.concatenate((a, b), axis=0))
print(np.concatenate((a, a), axis=1))
# Output:
# [[1 2]
# [3 4]
# [5 6]]
# [[1 2 1 2]
# [3 4 3 4]]
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. #}
आम गलतियां
- एक tuple की बजाय arrays को separate arguments की तरह pass करना
- mismatched shapes वाले arrays जोड़ना
- axis 0 और axis 1 confuse करना
चैप्टर सारांश
- arrays का एक tuple pass करें
- दूसरी dimensions match होनी चाहिए
- axis join direction चुनता है
- एक नया array return करता है
🔒
Chapter Quiz — Complete all 7 topics to unlock
0/7 topics done
Complete these topics first: