Beispiel #1
0
def get_aws_station_info():
    '''Bring in station information and assign cluster to each '''
    # Connect to AWS
    conn, cur = uf.aws_connect()
    # Query cabi_region - note that longitute should always come first to generate a geographic Point
    stations_df = pd.read_sql(
        """SELECT lon, lat, name, short_name, name  from cabi_stations_temp""",
        con=conn)
    return stations_df
Beispiel #2
0
        incwage integer,
        pwstate2 integer,
        tranwork integer,
        carpool integer,
        riders integer,
        trantime integer,
        qtrantim integer,
        qtranwor integer)
        )
    """)


if __name__ == "__main__":
    # Connect to AWS
    uf.set_env_path()
    conn, cur = uf.aws_connect()
    # Load CSV FROM IPMUS Download as Dataframe
    csv_name = 'usa_00007'
    acs_df = pd.read_csv(csv_name + ".csv")
    # Set Primary Key
    acs_df.reset_index(inplace=True)
    # Fill all na with zeros
    acs_df.fillna(0, inplace=True)
    # Output dataframe as CSV
    outname = csv_name + "_pipe_delimited"
    acs_df.to_csv(outname + ".csv", index=False, sep='|')
    # Create Database
    create_acs(cur)
    # Load to Database
    uf.aws_load(outname, "acs", cur)
    # Commit changes to database