Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When using Pandas read_csv function, several cells trail off with "..." instead of having the full text. Any suggestions?

I saved an excel file into a CSV and uploaded it using Google Colab's file.upload().

from google.colab import files
uploaded = files.upload()

If I view "uploaded" it shows the full file. When I save it into a data frame using:

data = pd.read_csv(io.StringIO(uploaded["OilEx No Tickers.csv"].decode("utf-8")))

data returns

websites cut off

which is useless as the websites are cut off. They do not work in the function I am trying to run them through later as they aren't the full site. Any suggestions? Thank you.

like image 948
djdono Avatar asked Oct 20 '25 01:10

djdono


1 Answers

The first time I faced this problem myself, I bookmarked PX0r's answer to this Stack Overflow question, which is to run this command, then re-display the DataFrame:

pd.set_option('max_colwidth', 800)

To reset this option to its default value without having to restart the kernel:

pd.reset_option('max_colwidth')

Some other useful commonly used options in the official docs: https://pandas.pydata.org/pandas-docs/stable/options.html#frequently-used-options

like image 89
Peter Leimbigler Avatar answered Oct 22 '25 04:10

Peter Leimbigler