Ravindra BagaleCourses & study guides

4. NumPy Essentials

4.2 dtypes

dtype Use
int64 / int32 Counts, qty
float64 Amounts, minutes
bool Flags
object Mixed / text (slow)
amount_txt = np.array(["64", "90", "240"])
# wrong for math — convert:
amount_num = amount_txt.astype(float)
print(amount_num.sum())

Ravindra Bagale's Tip

Khup students CSV madhun amount string mhanun yeto aani sum weird yeto kiwa error. pandas madhe pan astype / to_numeric shika — NumPy dtype concept tyachya maghe aahe. Lakshat theva!