6
변경 : 내가 특별히 지정된추가 행이 내가 가진 문제는 DataFrame에 행을 추가하는 열 DTYPE 변화이다 DTYPE
>>> from pandas import DataFrame
>>> df = DataFrame({'a' : range(10)}, dtype='i4')
>>> df
a
0 0
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
[10 rows x 1 columns]
DTYPE가 INT32 일에 (즉, 'I4')로 캔 알 : I가 D 지정 시도한
>>> df.loc[10] = 99
>>> df
a
0 0
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 99
[11 rows x 1 columns]
>>> df.dtypes
a float64
dtype: object
:
>>> df.dtypes
a int32
dtype: object
그러나 연속 첨가 변경하는 D- 타입 float64 내가 추가 한 값의 유형 :
>>> import numpy as np
>>> df = DataFrame({'a' : np.arange(10, dtype=np.int32)})
>>> df.dtypes
a int32
dtype: object
>>> df.loc[10] = np.int32(0)
>>> df.dtypes
a float64
dtype: object
하지만 작동하지 않습니다. 새로운 객체를 반환하는 함수를 사용하지 않고도 해결책이 있습니까?
는 플로트하기 : http://pandas.pydata.org/pandas -docs/stable/gotchas.html # support-for-integer-na (나는이 문제로 어려움을 겪고있었습니다) – fantabolous