This can work with no extra libraries involved:
```
def exportToPandas(self, query):
try:
logger.info("\t----> Exporting query to Pandas.dataframe: " + query)
stmt = self.con.execute(query)
df = pandas.DataFrame(stmt.fetchall(), columns=stmt.columns())
logger.info(" > " + str(df.shape[0]) + " rows x " + str(df.shape[1]) + " columns were exported to dataframe")
return df
except Exception as e:
raise Exception("Failed to execute query " + query + ": " + str(e))
```
This is another approach not involving extra libraries:
```
def exportToPandas(self, query):
try:
logger.info("\t----> Exporting query to Pandas.dataframe: " + query)
stmt = self.con.execute(query)
df = pandas.DataFrame(stmt.fetchall(), columns=stmt.columns())
logger.info(" > " + str(df.shape[0]) + " rows x " + str(df.shape[1]) + " columns were exported to dataframe")
return df
except Exception as e:
raise Exception("Failed to export query " + query + ": " + str(e))
```