Natig Aliyev
Natig Aliyev

Reputation: 389

.astype("int") or .astype(int)? Any differences between with and without quote/double?

I have a DataFrame and one of its column consist of float type objects. I want to convert to int. As I tried, both .astype("int") and astype(int) methods work. I just wonder whether there is/are any difference(s)?

Upvotes: 6

Views: 5332

Answers (1)

MaxU - stand with Ukraine
MaxU - stand with Ukraine

Reputation: 210842

AFAIK there is no major difference...

.astype(dtype) should accept everything what is accepted by numpy.dtype().

Internally it does this:

dtype = np.dtype(dtype)

Upvotes: 9

Related Questions