How does NumPy's astype work for casting arrays, and what are the safe/same_kind/unsafe casting rules?
Role: Data Scientist
Category: Data Manipulation (SQL/Python)
Difficulty: medium
Interview Round: Other
Overview: Asks how NumPy's astype converts an array to a new dtype and how the casting argument decides which conversions are allowed. Tests the copy behavior, the safe, same_kind and unsafe rules, silent truncation and overflow, and how to make risky casts fail early.