In [1]:

    import csv
    import pandas as pd
    import os
    import glob

In [2]:

    os.getcwd()
    os.chdir(r'C:\Users\anson\Dropbox\Dissertation\Fracfocus\FracFocusCSV\Fracfocus_raw')

In [3]:

    ###merge the raw files from FracFocus

In [4]:

    filename = 'FracFocusRegistry_'

In [5]:

    df_final = pd.DataFrame()

In [6]:

    for i in range(1,23):
        df = pd.read_csv("FracFocusRegistry_" + str(i) + ".csv")
        df_final = df_final.append(df)

    C:\Users\anson\AppData\Local\Temp\ipykernel_36012\3978310428.py:2: DtypeWarning: Columns (37) have mixed types. Specify dtype option on import or set low_memory=False.
      df = pd.read_csv("FracFocusRegistry_" + str(i) + ".csv")
    C:\Users\anson\AppData\Local\Temp\ipykernel_36012\3978310428.py:3: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
      df_final = df_final.append(df)
    C:\Users\anson\AppData\Local\Temp\ipykernel_36012\3978310428.py:2: DtypeWarning: Columns (35,37) have mixed types. Specify dtype option on import or set low_memory=False.
      df = pd.read_csv("FracFocusRegistry_" + str(i) + ".csv")
    C:\Users\anson\AppData\Local\Temp\ipykernel_36012\3978310428.py:3: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
      df_final = df_final.append(df)
    C:\Users\anson\AppData\Local\Temp\ipykernel_36012\3978310428.py:2: DtypeWarning: Columns (35,37) have mixed types. Specify dtype option on import or set low_memory=False.
      df = pd.read_csv("FracFocusRegistry_" + str(i) + ".csv")
    C:\Users\anson\AppData\Local\Temp\ipykernel_36012\3978310428.py:3: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
      df_final = df_final.append(df)
    C:\Users\anson\AppData\Local\Temp\ipykernel_36012\3978310428.py:2: DtypeWarning: Columns (35,37) have mixed types. Specify dtype option on import or set low_memory=False.
      df = pd.read_csv("FracFocusRegistry_" + str(i) + ".csv")
    C:\Users\anson\AppData\Local\Temp\ipykernel_36012\3978310428.py:3: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
      df_final = df_final.append(df)
    C:\Users\anson\AppData\Local\Temp\ipykernel_36012\3978310428.py:2: DtypeWarning: Columns (37) have mixed types. Specify dtype option on import or set low_memory=False.
      df = pd.read_csv("FracFocusRegistry_" + str(i) + ".csv")
    C:\Users\anson\AppData\Local\Temp\ipykernel_36012\3978310428.py:3: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
      df_final = df_final.append(df)
    C:\Users\anson\AppData\Local\Temp\ipykernel_36012\3978310428.py:2: DtypeWarning: Columns (35,37) have mixed types. Specify dtype option on import or set low_memory=False.
      df = pd.read_csv("FracFocusRegistry_" + str(i) + ".csv")
    C:\Users\anson\AppData\Local\Temp\ipykernel_36012\3978310428.py:3: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
      df_final = df_final.append(df)
    C:\Users\anson\AppData\Local\Temp\ipykernel_36012\3978310428.py:2: DtypeWarning: Columns (37) have mixed types. Specify dtype option on import or set low_memory=False.
      df = pd.read_csv("FracFocusRegistry_" + str(i) + ".csv")
    C:\Users\anson\AppData\Local\Temp\ipykernel_36012\3978310428.py:3: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
      df_final = df_final.append(df)
    C:\Users\anson\AppData\Local\Temp\ipykernel_36012\3978310428.py:2: DtypeWarning: Columns (37) have mixed types. Specify dtype option on import or set low_memory=False.
      df = pd.read_csv("FracFocusRegistry_" + str(i) + ".csv")
    C:\Users\anson\AppData\Local\Temp\ipykernel_36012\3978310428.py:3: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
      df_final = df_final.append(df)
    C:\Users\anson\AppData\Local\Temp\ipykernel_36012\3978310428.py:2: DtypeWarning: Columns (37) have mixed types. Specify dtype option on import or set low_memory=False.
      df = pd.read_csv("FracFocusRegistry_" + str(i) + ".csv")
    C:\Users\anson\AppData\Local\Temp\ipykernel_36012\3978310428.py:3: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
      df_final = df_final.append(df)
    C:\Users\anson\AppData\Local\Temp\ipykernel_36012\3978310428.py:2: DtypeWarning: Columns (37) have mixed types. Specify dtype option on import or set low_memory=False.
      df = pd.read_csv("FracFocusRegistry_" + str(i) + ".csv")
    C:\Users\anson\AppData\Local\Temp\ipykernel_36012\3978310428.py:3: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
      df_final = df_final.append(df)
    C:\Users\anson\AppData\Local\Temp\ipykernel_36012\3978310428.py:2: DtypeWarning: Columns (35,37) have mixed types. Specify dtype option on import or set low_memory=False.
      df = pd.read_csv("FracFocusRegistry_" + str(i) + ".csv")
    C:\Users\anson\AppData\Local\Temp\ipykernel_36012\3978310428.py:3: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
      df_final = df_final.append(df)
    C:\Users\anson\AppData\Local\Temp\ipykernel_36012\3978310428.py:2: DtypeWarning: Columns (35) have mixed types. Specify dtype option on import or set low_memory=False.
      df = pd.read_csv("FracFocusRegistry_" + str(i) + ".csv")
    C:\Users\anson\AppData\Local\Temp\ipykernel_36012\3978310428.py:3: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
      df_final = df_final.append(df)
    C:\Users\anson\AppData\Local\Temp\ipykernel_36012\3978310428.py:2: DtypeWarning: Columns (35) have mixed types. Specify dtype option on import or set low_memory=False.
      df = pd.read_csv("FracFocusRegistry_" + str(i) + ".csv")
    C:\Users\anson\AppData\Local\Temp\ipykernel_36012\3978310428.py:3: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
      df_final = df_final.append(df)
    C:\Users\anson\AppData\Local\Temp\ipykernel_36012\3978310428.py:2: DtypeWarning: Columns (35) have mixed types. Specify dtype option on import or set low_memory=False.
      df = pd.read_csv("FracFocusRegistry_" + str(i) + ".csv")
    C:\Users\anson\AppData\Local\Temp\ipykernel_36012\3978310428.py:3: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
      df_final = df_final.append(df)
    C:\Users\anson\AppData\Local\Temp\ipykernel_36012\3978310428.py:2: DtypeWarning: Columns (35) have mixed types. Specify dtype option on import or set low_memory=False.
      df = pd.read_csv("FracFocusRegistry_" + str(i) + ".csv")
    C:\Users\anson\AppData\Local\Temp\ipykernel_36012\3978310428.py:3: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
      df_final = df_final.append(df)
    C:\Users\anson\AppData\Local\Temp\ipykernel_36012\3978310428.py:2: DtypeWarning: Columns (35) have mixed types. Specify dtype option on import or set low_memory=False.
      df = pd.read_csv("FracFocusRegistry_" + str(i) + ".csv")
    C:\Users\anson\AppData\Local\Temp\ipykernel_36012\3978310428.py:3: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
      df_final = df_final.append(df)
    C:\Users\anson\AppData\Local\Temp\ipykernel_36012\3978310428.py:2: DtypeWarning: Columns (35) have mixed types. Specify dtype option on import or set low_memory=False.
      df = pd.read_csv("FracFocusRegistry_" + str(i) + ".csv")
    C:\Users\anson\AppData\Local\Temp\ipykernel_36012\3978310428.py:3: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
      df_final = df_final.append(df)
    C:\Users\anson\AppData\Local\Temp\ipykernel_36012\3978310428.py:2: DtypeWarning: Columns (35) have mixed types. Specify dtype option on import or set low_memory=False.
      df = pd.read_csv("FracFocusRegistry_" + str(i) + ".csv")
    C:\Users\anson\AppData\Local\Temp\ipykernel_36012\3978310428.py:3: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
      df_final = df_final.append(df)
    C:\Users\anson\AppData\Local\Temp\ipykernel_36012\3978310428.py:2: DtypeWarning: Columns (35) have mixed types. Specify dtype option on import or set low_memory=False.
      df = pd.read_csv("FracFocusRegistry_" + str(i) + ".csv")
    C:\Users\anson\AppData\Local\Temp\ipykernel_36012\3978310428.py:3: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
      df_final = df_final.append(df)
    C:\Users\anson\AppData\Local\Temp\ipykernel_36012\3978310428.py:2: DtypeWarning: Columns (35) have mixed types. Specify dtype option on import or set low_memory=False.
      df = pd.read_csv("FracFocusRegistry_" + str(i) + ".csv")
    C:\Users\anson\AppData\Local\Temp\ipykernel_36012\3978310428.py:3: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
      df_final = df_final.append(df)
    C:\Users\anson\AppData\Local\Temp\ipykernel_36012\3978310428.py:2: DtypeWarning: Columns (3,35) have mixed types. Specify dtype option on import or set low_memory=False.
      df = pd.read_csv("FracFocusRegistry_" + str(i) + ".csv")
    C:\Users\anson\AppData\Local\Temp\ipykernel_36012\3978310428.py:3: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
      df_final = df_final.append(df)
    C:\Users\anson\AppData\Local\Temp\ipykernel_36012\3978310428.py:2: DtypeWarning: Columns (35) have mixed types. Specify dtype option on import or set low_memory=False.
      df = pd.read_csv("FracFocusRegistry_" + str(i) + ".csv")
    C:\Users\anson\AppData\Local\Temp\ipykernel_36012\3978310428.py:3: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
      df_final = df_final.append(df)

In [7]:

    df_final['date'] = pd.to_datetime(df_final['JobEndDate'],errors='coerce')
    df_final['year'] = df_final['date'].dt.year
    df_final['month'] = df_final['date'].dt.month

In [8]:

    df_final.to_csv('merged_raw_original.csv', index=True, encoding='utf-8-sig')