I am opening a file with many features in iPython notebook (~145k observations, ~ 2000 features). When using df.describe, the output uses ellipsis in summarizing the features. How can I output the description of all the rows to a file?
[In]
url = "some large file"
df = pd.read_csv(url)
df.describe()
[Out]
Col 1 Col 2 Col 3 Col 4 ... Col 1998 Col 1999 Col 2000
mean Blah Blah Blah Blah ... Blah Blah Blah
std
min
etc
I thought I could avoid the ellipsis by writing the output to a file:
[In]
url1 = "Some output file"
f = open(url1, 'w')
f.write(str(df.describe()))
f.close()
But the file looks the same as the output.
pd.options.display.max_columns = 2000
If you don't want to make the change permanently for the notebook, (e.g., to avoid excessive output in other cells), you can also use pd.option_context
:
with pd.option_context('display.max_columns', 2000):
print(df.describe())
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