3

I was going through documentation of sklearn.preprocessing.StandardScaler and came across denotions such as X[, y], X[, copy] in methods like fit(X[, y]), inverse_transform(X[, copy]). What do those denotions mean exactly?

Link: http://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.StandardScaler.html

Ivan Vinogradov
  • 4,269
  • 6
  • 29
  • 39
iamai
  • 473
  • 1
  • 4
  • 11
  • 2
    That is not Python notation, it is just documentation notation that means the parameters between the square brackets are optional. It follows common conventions on [usage messages](https://en.wikipedia.org/wiki/Usage_message). – jdehesa May 30 '18 at 13:09

2 Answers2

3

In this case it indicates optional function arguments.

For example, transform is described as transform(X[, y, copy]), where the full function signature is transform(X, y=’deprecated’, copy=None). X is required, but y and copy will receive the default values if not specified.

0x5453
  • 12,753
  • 1
  • 32
  • 61
1

It means that arguments in the bracket are optional.

ie. inverse_transform(X[, copy]) means you have to pass in X but copy is optional.

ᴘᴀɴᴀʏɪᴏᴛɪs
  • 7,169
  • 9
  • 50
  • 81