facebookresearch / HolisticTraceAnalysis

A library to analyze PyTorch traces.
http://hta.readthedocs.io
MIT License
306 stars 43 forks source link

replace uses of agg("operation") with aggregate_func() #183

Closed igorsugak closed 2 months ago

igorsugak commented 2 months ago

Summary: X-link: https://github.com/ctrl-labs/src2/pull/34567

Pandas-2.0.0 changed default behavior of many methods on DataFrame that take argument numeric_only (for example sum, mean, etc). In the past, if numeric_only, the default value was None, and resulted into non-numeric columns being silently dropped. Now, the default value of numeric_only is True. This has two consequences:

In an attempt to facilitate the upgrade, this rewrites uses of agg("aggregate_func") calls into aggregate_func(). Later this will enable using Pyre to detect places that requre explicit numeric_only argument to be compatible with Pandas-2.0.0. This is not a semantic change, the effect should be equivalent with the previous spelling.

This was generated with the following one-liner:

fbgr '\.agg\("[a-z]+"\)' -ls | xargs perl -pi -e 's,\.agg\("([a-z]+)"\),.\1(),'
arc f

Inspected all changes.

Differential Revision: D62195922

facebook-github-bot commented 2 months ago

This pull request was exported from Phabricator. Differential Revision: D62195922

facebook-github-bot commented 2 months ago

This pull request has been merged in facebookresearch/HolisticTraceAnalysis@727ae37c0534713f6c3ce4565eaeb6754405f80f.