I have a big problem with my Dash app,
Basically the project is to make a dashboard, half made of graphs (left side) and the other side should display data from a table imported from an Excel file (i used Pandas for this).
This problem concerns the right side of the board, when I import data from my Excel file, they are not being displayed line by line, but instead the lines are “stuck” together.
An example :
Here you can see in red where there should normally be a newline \n so we can see the data line by line like this :
20/01 | 17:00 | Text description here1
17/01 | 11:00 | Text description here2
16/01 | 16:32 | Text description here3
And I’ve been searching hours and I didn’t find a way to do it, given that I’m using Dash as my html page, because I believe it can be done with some framework but it would require to use a “proper” html file instead of using the method provided by Dash. I start to believe that I should chuck out everything… Some help would be very welcome, thank you.
The code so far is :
# Importation of the file
file = r".. test.xlsx"
try:
df = pd.read_excel(file)
#print(df)
except OSError:
print("Impossible to read :", file)
# Here we display the information from the file
test = []
for index, row in df.iterrows():
x = row['Date'] + ' | ' + row['Description'] + ' | ' + row['Titre de la consigne'] + ' | ' + row['Prenom'] + ' | '
+ row['Choix des equipements 1'] + ' | ' + row['Choix des equipements 2'] + ' | ' + row['Prenom'] + '\r\n'
test.append(x)
df_string = '\n'.join(test) # adding a '\n' at the end of each line but it doesn't change anythin
print(df_string)
And I take df_string that I my into html.P like this :
html.P(df_string)