-> 1377 raise KeyError(f"{not_found} not in index")
1378
1379
KeyError: "['sepal_lingth'] not in index"
%% Cell type:markdown id:90dce1de tags:
# Types
%% Cell type:code id:0783d68c tags:
``` python
iris_dataframe.dtypes
```
%%%% Output: execute_result
sepal_length float64
sepal_width float64
petal_length float64
petal_width float64
species object
dtype: object
%% Cell type:markdown id:9a38303b tags:
**Question**: if there are nan values would the datatype be 'object'?
**Answer**: not necessarily, numeric columns can still have NaN values. More specifically:
* Floating-point (type = 'float') columns can have NaN values.
* An integer column **cannot** have NaN values. If you include NaN values in an integer column the entire column is (automatically) turned into floating point. This is the result of some internal implementation in pandas.
* Object columns typically indicate string values, a common example is un-converted datetimes read from csv. Use pd.to_datetime to convert these to pandas' native type so that they are handled properly.
%% Cell type:code id:6c071566 tags:
``` python
# There is also a categorical type conversion we can do: