EDIT: I have just found a line in my code that changes my df from a RangeIndex to a numeric Int64Index. How and why does this happen?
Before this line all my df are type RangeIndex. After this line of code df_new changes to type Int64Index which is a Range Index instead of a Numeric Index.
# remove rows with DMT, no lumninance data
df_new = df_new[df_new.Person != 'DMT']
Can anyone explain the following?
Int64Index and RangeIndex
"Warning Indexing on an integer-based Index with floats has been clarified in 0.18.0, for a summary of the changes, see here. Int64Index is a fundamental basic index in pandas. This is an Immutable array implementing an ordered, sliceable set. Prior to 0.18.0, the Int64Index would provide the default index for all NDFrame objects. RangeIndex is a sub-class of Int64Index added in version 0.18.0, now providing the default index for all NDFrame objects. RangeIndex is an optimized version of Int64Index that can represent a monotonic ordered set. These are analogous to Python range types." [from https://pandas.pydata.org/pandas-docs/stable/advanced.html#int64index-and-rangeindex]
- What why does index type change from RangeIndex to Int64Index?
What are the key or important differences between working with the dataframes with the two different types of indexes? (RangeIndex & Int64Index)
type(df_val.index)
pandas.core.indexes.range.RangeIndex
type(df_new.index)
pandas.core.indexes.numeric.Int64Index