我的dtype都是int32是否影響日後運算?
![image](http://kwassistfile.cupoy.com/0000017A09D88CFC000000126375706F795F72656C656173655155455354/1623377370012/large) 使用win10 64 bit, 安裝x86_64的Anaconda Indivisual,在上一節就有發現這問題,今天再遇到想到如果會影響位元數,是否會影響日後一些運算?是否有方法調整或改變? 有用vmware 跑ubuntu的ipython看,結果是與老師的完全相同(int64),只有windows是int32
回答列表
-
2021/06/16 上午 00:23Chu Jia Ping贊同數:0不贊同數:0留言數:0
好像 Windows 64bit 一直有這個設計上的問題 目前為止我個人做資料工程的經驗很少用到這麼大的 `long long int` (int64) 如果真的需要的話就用 astype 轉換吧 ```python arr_int64 = arr_int32.astype(np.int64) ``` 參考資料: * Some types, such as `int` and `intp`, have differing bitsizes, dependent on the platforms (e.g. 32-bit vs. 64-bit machines). * https://stackoverflow.com/questions/36278590/numpy-array-dtype-is-coming-as-int32-by-default-in-a-windows-10-64-bit-machine * https://docs.scipy.org/doc/numpy-1.10.1/user/basics.types.html