sample_dataframes
This is an old revision of the document!
dummy 1
In [6]: import pandas as pd import numpy as np rand = np.random.RandomState(1) df = pd.DataFrame({'A': ['foo', 'bar'] * 3, 'B': rand.randn(6), 'C': rand.randint(0, 20, 6)}) In [7]: print(df) A B C 0 foo 1.624345 5 1 bar -0.611756 18 2 foo -0.528172 11 3 bar -1.072969 10 4 foo 0.865408 14 5 bar -2.301539 18
Useful for things like
In [8]: gb = df.groupby(['A'])
Ref:
sample_dataframes.1711490890.txt.gz · Last modified: 2024/03/26 22:08 by raju