Earl Chase <[email protected]> writes:

> ... But this folding idea sounds much
> more interesting. Could you share an example of folding tables in Pandas so
> I can see what it looks like? I haven't been able to find anything that
> matches what you are describing here.

import pandas as pd
import numpy as np

# create a long pandas dataframe with many columns  made of random numbers
df = pd.DataFrame(np.random.random((1000, 100)))

# print the dataframe limiting the max displayed rows and columns
pd.set_option('display.max_rows', 10)
pd.set_option('display.max_columns', 5)
print(df)

           0         1   ...        98        99
0    0.217596  0.907290  ...  0.474294  0.947497
1    0.579225  0.864676  ...  0.865331  0.633831
2    0.224613  0.802887  ...  0.132551  0.801142
3    0.284494  0.216152  ...  0.345880  0.431852
4    0.937078  0.529508  ...  0.692992  0.186391
..        ...       ...  ...       ...       ...
995  0.750684  0.319579  ...  0.883523  0.372406
996  0.552557  0.950117  ...  0.901683  0.216205
997  0.958069  0.883422  ...  0.526706  0.751579
998  0.606767  0.285769  ...  0.263309  0.471658
999  0.885801  0.108238  ...  0.601386  0.687026

[1000 rows x 100 columns]

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

Reply via email to