Issue
I'm trying to add a specific URL into a dataFrame in order to export the information into a csv. Every row of this csv has a specific ID added at the end of the URL attached
The URL example would be like this:
https://example.navigator.com/index.php?pagina=demoData;ID
The problem is that if I convert this into a string and then put into a dataframe column once I export the csv looks like this.
Few Lines of the CSV:
It separates in 2 columns the URL.
How can I add the ID properly in order to have the entire URL in one column in the resulting csv?
Thank you
Solution
import pandas as pd
s = 'https://example.navigator.com/index.php?pagina=demoData;ID'
pd.DataFrame([s,s]).to_csv('test.csv', sep=';')
creates
;0
0;"https://example.navigator.com/index.php?pagina=demoData;ID"
1;"https://example.navigator.com/index.php?pagina=demoData;ID"
If you open it with Excel, you can use the From text/csv
function in the Tab Data
and specify the delimiter if you encounter further problems.
Answered By - Firefighting Physicist
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.