Why is this astype call needed?