I'm using a panda dataframe to read csv data into a Flask project. I'm trying to remove the Dataframe indexes in the HTML table using the set_index method:
overviewTable.set_index('Tower Number', inplace=True)
When I use this Method the Tower Number Header jumps down a row below all the other headers.
The HTML looks like this:
<div class="row table-responsive">
<div class="tower-table">
{{ overview|safe }}
</div>
</div>
and the Python:
overview = pandas.read_csv('../overview_table.csv')
overviewTable = overview[cols]
overviewTable.set_index('Tower Number', inplace=True)
@app.route('/')
def dash():
return render_template('dash.html', overview=overviewTable[1:167].to_html())
And the CSS:
.tower-table {
overflow-x: hidden;
overflow-y: scroll;
width: 100%;
height: 500px;
background-color: darkgrey;
border-color: #003430;
border-radius: 5px;
}
.tower-table tr {
height: 50px;
}
.tower-table thead tr {
height: 100px;
border-top: none;
}
Is there another method to remove the indexes without affecting the headers. Or is there anything I could do in the CSS etc to stop the header moving down a row
.to_html(index=False)