NumPy - Array Data TypesWhich of the following is the correct syntax to create a numpy array of type int64?Anp.array([1, 2, 3], dtype=int32)Bnp.array([1, 2, 3], type='int64')Cnp.array([1, 2, 3], type=int64)Dnp.array([1, 2, 3], dtype='int64')Check Answer
Step-by-Step SolutionSolution:Step 1: Identify correct parameter for data typeIn numpy, the parameter to specify data type is 'dtype'.Step 2: Check correct usage of dtypeIt should be a string or numpy type, so 'dtype="int64"' is correct.Final Answer:np.array([1, 2, 3], dtype='int64') -> Option DQuick Check:Use dtype='int64' to specify 64-bit integers [OK]Quick Trick: Use dtype='int64' to set 64-bit integer type [OK]Common Mistakes:Using 'type' instead of 'dtype'Passing dtype as int32 instead of int64
Master "Array Data Types" in NumPy9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More NumPy Quizzes Aggregation Functions - np.cumsum() for cumulative sum - Quiz 11easy Array Manipulation - np.split() for dividing arrays - Quiz 13medium Array Operations - Comparison operations - Quiz 6medium Array Operations - Why vectorized operations matter - Quiz 14medium Array Operations - Type promotion in operations - Quiz 5medium Creating Arrays - np.eye() for identity matrices - Quiz 9hard Indexing and Slicing - Boolean indexing - Quiz 4medium NumPy Fundamentals - NumPy array vs Python list performance - Quiz 7medium NumPy Fundamentals - Array attributes (shape, dtype, ndim, size) - Quiz 2easy NumPy Fundamentals - NumPy array vs Python list performance - Quiz 14medium