1

Hello i am making a software which gets data from an API and puts it in excel in csv format using pandas.

df2 = pd.DataFrame(data, columns=["Certificate #", "Lab", "Shape", "Size", "Color", "Clarity", "Min", "Max", "Hgt", "Cut", "Depth", "Table", "Pol", "Sym", "Flour", "Key to Symbols", "Comments", "Type", "Rep. Date", "Stock #", "$/ct", "Rap", "Company"])
df2.to_csv(os.path.join(os.getcwd(), "OUTPUTS", "GiaOut_" + strftime("%d-%m-%Y") + "_" + sys.argv[1]))

data is a list of lists where each item is a string. i want the second column "Lab" to be a hyperlink. it should display the text "LAB" underlined in blue and a link behind it.

thanks

1
  • You can't save a hyperlink in a csv. It would have to be an Excel file format. Commented Sep 10, 2020 at 1:51

1 Answer 1

1
  1. You have to create a styled data frame and then only you can save it as an Excel format.
  2. If you try to save it through df.to_excel, all your formatting will not be gonna save. Instead of this, you have to create/open an excel spreadsheet through ExcelWriter and have to save according to this code snippet.
Sign up to request clarification or add additional context in comments.

Comments

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.