Skip to content

Instantly share code, notes, and snippets.

@hnykda
Created June 20, 2018 20:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hnykda/0099d0629f8ba45ace50c3e8896a2fb2 to your computer and use it in GitHub Desktop.
Save hnykda/0099d0629f8ba45ace50c3e8896a2fb2 to your computer and use it in GitHub Desktop.
In [24]: %time df.loc[:, 'cc'] = np.full(df.shape[0], pd.np.nan, dtype='float16')
CPU times: user 286 µs, sys: 5.47 ms, total: 5.75 ms
Wall time: 4.41 ms
In [25]: %time df.loc[:, 'ccc'] = np.full(df.shape[0], pd.np.nan, dtype='float16')
CPU times: user 24.5 ms, sys: 19.2 ms, total: 43.7 ms
Wall time: 39.5 ms
In [26]: %time df.loc[:, 'cccc'] = np.full(df.shape[0], pd.np.nan, dtype='float16')
CPU times: user 492 ms, sys: 1.2 s, total: 1.69 s
Wall time: 1.69 s
In [27]: %time df.loc[:, 'ccccc'] = np.full(df.shape[0], pd.np.nan, dtype='float16')
CPU times: user 516 ms, sys: 1.2 s, total: 1.72 s
Wall time: 1.72 s
In [28]: %time df.loc[:, 'cccccc'] = np.full(df.shape[0], pd.np.nan, dtype='float16')
CPU times: user 453 ms, sys: 1.19 s, total: 1.65 s
Wall time: 1.65 s
In [29]: %time df.loc[:, 'ccccccc'] = np.full(df.shape[0], pd.np.nan, dtype='float16')
CPU times: user 577 ms, sys: 1.14 s, total: 1.72 s
Wall time: 1.72 s
In [30]: %time df.loc[:, 'd'] = np.full(df.shape[0], pd.np.nan, dtype='float16')
CPU times: user 423 ms, sys: 1.22 s, total: 1.65 s
Wall time: 1.65 s
In [31]: %time df.loc[:, 'dd'] = np.full(df.shape[0], pd.np.nan, dtype='float16')
CPU times: user 575 ms, sys: 1.14 s, total: 1.72 s
Wall time: 1.72 s
In [32]: %time df.loc[:, 'ddd'] = np.full(df.shape[0], pd.np.nan, dtype='float16')
CPU times: user 11.5 ms, sys: 27.4 ms, total: 38.9 ms
Wall time: 33.3 ms
In [33]: %time df.loc[:, 'dddd'] = np.full(df.shape[0], pd.np.nan, dtype='float16')
CPU times: user 475 ms, sys: 1.19 s, total: 1.66 s
Wall time: 1.67 s
In [34]: %time df.loc[:, 'ddddd'] = np.full(df.shape[0], pd.np.nan, dtype='float16')
CPU times: user 586 ms, sys: 1.14 s, total: 1.73 s
Wall time: 1.73 s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment