0

I want to make a simple html page which looks like this: enter image description here The text colored in Orange is the dynamic text. I want to filter the excel table on the webpage and print the specified technology and subTechnology data in the html as output.

import pandas as pd
filter = 'LTE2'
df = pd.read_csv("data.csv", delimiter=';')
df = df[df['subTechnology'] == filter]
df.to_html('index.html', index=False)

With the help of a thoughtful contribution, the df.to_html works well for the data but I still don't know how to deal with the text above the table as shown in the screenshot.

And here is my data source:

Technology;subTechnology;Package;Type;Date
4G;LTE2;2.0.5;Major Update;08.10.2017
4G;LTE2;4.4;Normal Update;09.10.2017
2G;GSM2;4.4.2;Major Update;02.12.2017
5G;5G2;1.1.2 mQ1;Major Update;02.01.2020
2G;GSM2A;1.0.7Q;Delivery;03.01.2020
4G;LTE20A;3.0.7;Normal Update;02.03.2020
2G;GSM17A;39142;Major Update;02.04.2020
5G;5G2A;0.2TD;Delivery;03.04.2020
3G;3G20;GF20 2.3;Normal Update;04.04.2020
2G;L2B;1.0TD;Delivery;02.07.2020
5G;5G2A;0.5TD;Delivery;02.08.2020
2G;GSM2B;1.0TD;Delivery;03.08.2020
2G;L2A;1.0.6Q;Delivery;02.10.2020
4G;LTE20A;6.0;Normal Update;02.11.2020

I am familiar with tools like xlsx2html and apsose.cells but I don't know how to filter the data as per the specified subTechnology and show only customized excel in the html. Any documentation or suggestions would be really appreciated.

3
  • What you want is to be able to filter in the website or to filter it locally and the build the website? Commented Jun 14, 2021 at 10:34
  • StackOverflow isn't a code-writing service - please edit the code of your honest attempt to solve this problem into your question as a minimal reproducible example and exalpin what goes wrong/isn't correct about the output. If there's an error message include the full text of this as text. Include some minimal sample data in the code. Commented Jun 14, 2021 at 10:37
  • @edoelas Ideally I want to be able to filter through the data on the webpage but I assume dealing with the dynamic content on a signle html page can be difficult, so I can even hardcode the "subTechnology" locally and generate the results to html. Commented Jun 14, 2021 at 10:38

1 Answer 1

1

You have pandas and python in your tags so I will answer using those technologies.

import pandas as pd

filter = 'LTE2'

# Load data as CSV
df = pd.read_csv("./data.csv", delimiter=';')
# Fitler data
df = df[df['subTechnology'] == filter]
# Save data in HTML format
df.to_html('./output.html', index=False)
Sign up to request clarification or add additional context in comments.

2 Comments

Thankyou. Do you also know if there a possibility to be able to select/filter the "subTechnology" in the html page itself?
I would recommend you to search for a js library that takes care of it. Now I can't think of any but I am sure there are plenty. Please, if my answer helped you mark the answer as accepted.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.