PY

PY(python_code, return_type)

Returns the value or object after running code in a Python Editor using the Microsoft Cloud runtime.

python_codeThe text/script to run.
return_typeThe number to indicate the return type:
0 = Excel value
1 = Python object

REMARKS
* This function was added in Microsoft 365.
* You can reference values in Excel using the xl() function, eg xl("A1:B10", headers=True).
* This function cannot be used with any other built-in Excel functions.
* Press Ctrl + Enter to commit the python code.
* Switch the formula bar into Pythin mode (Formulas > Insert Python > Custom Python Formula, Explore Python Samples)
* Formula Errors #BLOCKED!, #PYTHON!, #CONNECT!, #TIMEOUT!
* Anaconda is a data science platform for analytics.
* link - insider.microsoft365.com/en-us/join/windows
* link - support.microsoft.com/en-gb/office/introduction-to-python-in-excel-55643c2e-ff56-4168-b1ce-9428c8308545
* link - support.microsoft.com/en-gb/office/getting-started-with-python-in-excel-a33fbcbe-065b-41d3-82cf-23d05397f53d
* link - support.microsoft.com/en-gb/office/troubleshoot-python-in-excel-errors-7736520d-47ef-43a8-b640-d826afb63249
* link - learn.microsoft.com/en-us/training/modules/intro-to-python/
* For more information, see the Python section
* This function was first released in August 2023.
* For the Microsoft documentation refer to support.microsoft.com

 A
1=PY(" 'Hello' + ' ' + 'World' ", 0)
2=PY(" xl(""Table1[#A1]"", headers=True) ", 1)
3=PY(" vDataFrame = xl(""A1:B10"", headers=True) ", 1)
vDataFrame.groupby('Category').agg('mean') ", 0)


© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited Top