python with Pandas
pandas is a Python package providing fast, flexible, and expressive data
structures designed to make working with structured (tabular, multidimensional,
potentially heterogeneous) and time series data both easy and intuitive.
In this article I will provide some snippets of how pandas can be used to read excel and json files.
Dependencies:
pip install pandas
pip install xlrd
Now to read the file my code would look something like this
Output:
Note:: xlrd is important to read excel files. Pandas can read csv file without xlrd package
Now convert this into json as below:
Now the fun begins. We shall convert the json to html
See you later..........
In this article I will provide some snippets of how pandas can be used to read excel and json files.
Dependencies:
pip install pandas
pip install xlrd
This is how my excel or csv file looks |
Output:
Note:: xlrd is important to read excel files. Pandas can read csv file without xlrd package
Now convert this into json as below:
my_json=myExcel.to_json("my.json")
This creates my.json fileNow the fun begins. We shall convert the json to html
#json read objectmy_read_json=pd.read_json("my.json") #json to htmlpdhtml=pd.DataFrame.to_html(my_read_json) #create html filemy_html = open('myHtml.html','w') my_html.write(pdhtml) my_html.close()
See you later..........
Comments
Post a Comment