I am saving text to csv file in Python 3.
Text is clean and does not have any tags.
Here is how it looks in Notepad:
Here is my text bulb:
unicodedata.normalize('NFKD',' '.join(i[1:-1])
).encode('ascii','ignore').decode()
Here is how I save it:
def save(filename, data):
with open(r"path to file\{}.csv".format(filename),"a",encoding="utf-8" ) as f:
w = csv.DictWriter(f, [coulm names],lineterminator="\n")
w.writeheader()
w.writerows(data[:10])
When I open file in Ipython Pandas as DataFrame I can see different styling of text like this:
How do I get rid of it and make all text look the same?
P.S. everything looks fine in gsheets:
PS. I use the follofing command in pandas:
data_full = pd.read_csv("restaurant_menu_with_entryurl_full.csv", encoding = 'utf8')
PS. Also if I select single column view in pandas the text looks uniform.
I was having the same issue. After digging a bit I found out that there is an option on Pandas to disable MathJax. Try doing this right after you import pandas:
import pandas as pd
pd.set_option('display.html.use_mathjax', False)
Reference for more display options on pandas: https://pandas.pydata.org/pandas-docs/stable/user_guide/options.html
From the link above:
"When True, Jupyter notebook will process table contents using MathJax, rendering mathematical expressions enclosed by the dollar symbol."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With