text_plain_output_1.png
import numpy as np

import pandas as pd

orders_data = pd.read_csv('../input/brazilian-ecommerce/olist_orders_dataset.csv')
payment_data = pd.read_csv('../input/brazilian-ecommerce/olist_order_payments_dataset.csv')
review_data = pd.read_csv('../input/brazilian-ecommerce/olist_order_reviews_dataset.csv')
items_data = pd.read_csv('../input/brazilian-ecommerce/olist_order_items_dataset.csv')
product_data = pd.read_csv('../input/brazilian-ecommerce/olist_products_dataset.csv')
customers_data = pd.read_csv('../input/brazilian-ecommerce/olist_customers_dataset.csv')
sellers_data = pd.read_csv('../input/brazilian-ecommerce/olist_sellers_dataset.csv')
product_trans_data = pd.read_csv('../input/brazilian-ecommerce/product_category_name_translation.csv')
geoloca_data = pd.read_csv('../input/brazilian-ecommerce/olist_geolocation_dataset.csv')

round(orders_data.isnull().sum() / len(orders_data) * 100, 2)

orders_data.order_purchase_timestamp

orders_data_1 = orders_data[orders_data['order_delivered_carrier_date'].notnull()]
miss_carrier = (orders_data_1['order_purchase_timestamp'] - orders_data_1['order_delivered_carrier_date']).mean()
miss_carrier

added_date = orders_data[orders_data['order_delivered_carrier_date'].isnull()]['order_purchase_timestamp'] - miss_carrier
added_date

orders_data['order_delivered_carrier_date'] = orders_data['order_delivered_carrier_date'].replace(np.nan, added_date)
orders_data.isnull().sum()

orders_data.isnull().sum()

orders_data.isnull().sum()

orders_data.dropna(inplace=True)

orders_data.isnull().sum()

orders_data.duplicated(['order_id']).sum()