LoginSignup
1
1

More than 5 years have passed since last update.

pandas の環境差分に対応する

Posted at

本家の変更はこれです。

pandas_version = pd.__version__.split('.')

def sort_by(df, key):
    if pandas_version[0] == '0' and int(pandas_version[1]) < 21:
        return df.sort(key, ascending=1)
    return df.sort_values(by=key, ascending=True)

誰かもっと良い解決方法知りませんか。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1