Skip to content

Create Dataframe

Create from CSV

import pandas as pd
nba = pd.read_csv("nba.csv")

Create from DB Results

results_df = pd.DataFrame(
    columns=[
        'lead_id', 
        'ekata_network_score', 
        'tier',
        'loan_amount',
        'loan_rate',
        'loan_term',
        'apr',
        'total_payments',
        'final_disposition'
    ])

for lead in accepted:
    lead_id = lead[0]
    final_disposition = lead[1]
    amort_deets = atlas.getAmortDeets(lead_id)
    loan_amount = amort_deets[0]
    loan_rate = amort_deets[1]
    loan_term = amort_deets[2]
    apr = amort_deets[3]
    total_payments = amort_deets[4]
    tier = atlas.getTierById(lead_id)
    ekata_network_score = atlas.ekataNetworkScore(lead_id)

    new_row = {
        'lead_id': int(lead_id),
        'ekata_network_score': ekata_network_score,
        'tier': tier,
        'loan_amount': loan_amount,
        'loan_rate': loan_rate,
        'loan_term': loan_term,
        'apr': apr,
        'total_payments': total_payments,
        'final_disposition': final_disposition
    }

    results_df = results_df.append(new_row, ignore_index=True)

results_df['lead_id'] = results_df['lead_id'].astype('int')
results_df.set_index('lead_id', inplace=True)

Series of index values

df.index

Array of all values

df.values

Value Datatypes

df.dtypes

DF Info<<

df.info()
Back to top