how to list columns in pandas code example
Example 1: pd dataframe get column names
lst = data.columns.values # data is dataframe
Example 2: get column names method
public static List getColumnNames(){
List columnList = new ArrayList<>();
try {
ResultSetMetaData rsMetaData = rs.getMetaData();
for (int colNum = 1; colNum < getColumnCount() ; colNum++) {
columnList.add(rsMetaData.getColumnLabel(colNum));
}
} catch (SQLException e) {
System.out.println("ERROR WHILE GETTING COLUMN NAMES "+ e.getMessage());
}
return columnList;
}