Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python generate html

# This is actually Python code that generates HTML
# importing pandas as pd
import pandas as pd
# creating the dataframe
df = pd.DataFrame({"Name": ['Zach', 'Don'],
                   "ID": [27123, 26124,]    }) # simple dataframe
print("=====Original DataFrame :")
print(df)
result = df.to_html()  #  convert to_html
print("=====HTML :")
print(result)

OUTPUT:
=====Original DataFrame :
   Name     ID
0  Zach  27123
1   Don  26124

=====HTML :

<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>Name</th>
      <th>ID</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>Zach</td>
      <td>27123</td>
    </tr>
    <tr>
      <th>1</th>
      <td>Don</td>
      <td>26124</td>
    </tr>
  </tbody>
</table>
 
PREVIOUS NEXT
Tagged: #python #generate #html
ADD COMMENT
Topic
Name
3+2 =