text_plain_output_1.png
import pandas as pd

df = pd.read_csv('../input/border-crossing-entry-data/Border_Crossing_Entry_Data.csv')
df

df.isnull().sum()

df.duplicated().sum()

df.loc[(df['Port Code'] == 103) | (df['Port Code'] == 3302)]

df.loc[(df['Port Name'] == 'Eastport') & (df['State'] == 'Maine'), 'Port Name'] = 'Eastport Maine'

Date = pd.to_datetime(df['Date'])
Date

df2 = pd.DataFrame(df)
df2

def longitude(x):
    b1 = x.split('(')[1]
    b2 = b1.split(')')
    for i in b2:
        return i.split()[0]
def latitude(x):
    b1 = x.split('(')[1]
    b2 = b1.split(')')
    for i in b2:
        return i.split()[1]
df2['latitude'] = df2.Location.apply(latitude)
df2['longitude'] = df2.Location.apply(longitude)

df2