开发者

changes in series type while assigning it to a df

开发者 https://www.devze.com 2022-12-07 17:26 出处:网络
I have created a series called \'doy\' and info about the series is as follows; doy.info() <class \'pandas.core.series.Series\'>

I have created a series called 'doy' and info about the series is as follows;

doy.info() <class 'pandas.core.series.Series'> RangeIndex: 282875 entries, 0 to 282874 Series name: None Non-Null Count Dtype


282875 non-null int32 dtypes: int32(1) memory usage: 1.1 MB

There are 282875 entries and doy is of int type.


However, when I assign the series to an existing df called 'dat2', the series seems to undergo some mysterious changes. The info about dat2 is given below. The inserted series 'doy' has 282675 entries and is of float type.

dat2["doy"]=doy

dat2.info() <class 'pandas.core.frame.DataFrame'> 开发者_运维技巧Int64Index: 282875 entries, 0 to 283074 Data columns (total 15 columns):

Column Non-Null Count Dtype


0 period 282875 non-null int64

1 gcm_rcp 282875 non-null object

2 DATE 282875 non-null int64

3 tmax 282875 non-null float64

4 tmin 282875 non-null float64

5 vprsd 282875 non-null float64

6 wind 282875 non-null float64

7 rain 282875 non-null float64

8 srad 282875 non-null float64

9 rhumd_tn 282875 non-null float64

10 rhumd_tx 282875 non-null float64

11 dewp 282875 non-null float64

12 avgtemp 282875 non-null float64

13 timestamp 282875 non-null datetime64[ns] 14 doy 282675 non-null float64

dtypes: datetime64ns, float64(11), int64(2), object(1) memory usage: 34.5+ MB

Any clue as to why this could be happening?

Thanks for your help in deciphering this.

explained in the question above.

0

精彩评论

暂无评论...
验证码 换一张
取 消