# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# %matplotlib inline 
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from scipy import stats
import seaborn as sns
from sklearn.datasets import load_boston

data = pd.read_csv("species.csv")
data.head()

data.shape

data.info()

# ###### Exclude differences 

data['Category'].value_counts()

data['Record_Status'].value_counts()

data['Occurrence'].value_counts()

data['Nativeness'].value_counts()

data['Abundance'].value_counts()

data['Seasonality'].value_counts()

data.isnull().sum()

# ###### Identify missing data

data['Occurrence']=data['Occurrence'].fillna('Not confirmed')

data.isnull().sum()

data['Conservation_Status'].value_counts()

data['Conservation_Status']=data['Conservation_Status'].fillna('Under Review')

data.isnull().sum()

data['Nativeness']=data['Nativeness'].fillna('Under Review')

data.isnull().sum()

data['Seasonality']=data['Seasonality'].fillna('Unknown')

data.isnull().sum()

data['Family']=data['Family'].fillna('Unknown')

data.isnull().sum()

# drop rows with missing values
data.dropna(inplace=True)

data.isnull().sum()

data = pd.DataFrame(data)
data.to_csv('species1.csv',index = False, header =("Species_ID","Park_Name","Category","Order","Family","Scientific_Name","Common_Names","Record_Status","Occurrence","Nativeness","Abundance","Seasonality","Conservation_Status"))
print(data)

data.shape

data.info()

data.duplicated()

StarcoderdataJupyterScriptsDedupFiltered