read_sql_query returns far more records than actual table rows
Question: I am trying to get the a postgresql table in to python data frame. But the
dataframe size is extremely larger than the actual number of table records
even though I specified an index column. What's causing this issue? Single
quotes/ commas in the database table?

    
    
    import psycopg2 as pg
    import pandas.io.sql as psql
    
    
    connection = pg.connect("dbname=BeaconDB user=admin password=root")
    dataframe = psql.read_sql_query(sql="SELECT * from encounters2", con=connection, index_col='encounter_id')
    print('size::::', dataframe.size)
    


Answer: [df.size](http://pandas.pydata.org/pandas-
docs/stable/generated/pandas.DataFrame.size.html) shows you the number of
elements (cells) in the DF

Demo:

    
    
    In [134]: df
    Out[134]:
       A   B
    0  3  11
    1  0   2
    
    In [135]: df.size
    Out[135]: 4
    
    In [136]: df.shape
    Out[136]: (2, 2)
    
    In [137]: len(df)
    Out[137]: 2
    
    In [138]: len(df.index)
    Out[138]: 2
    

