For some reason the fill_null() compute function is missing from the latest docs.
https://github.com/apache/arrow/blob/master/python/pyarrow/tests/test_compute.py Look at the unit tests in test_fill_null(). Sent from my iPad On Jul 4, 2022, at 8:15 AM, H G <[email protected]> wrote: External Email: Use caution with links and attachments Thanks for the input. Filtering is possible to get the null value using table.filter(table['animals'].is_null()) However, I am struggling to set value to this filter. Any suggestions? On Mon, 4 Jul 2022 at 16:45, Michael <[email protected]<mailto:[email protected]>> wrote: This section of the cookbook might help: https://arrow.apache.org/cookbook/py/data.html#filtering-arrays-using-a-mask<https://urldefense.com/v3/__https://arrow.apache.org/cookbook/py/data.html*filtering-arrays-using-a-mask__;Iw!!KSjYCgUGsB4!cvBXun8VADWdMPHICK36UXk7SCwLLS9c0pMC18SIcA2Sk2W21DsColPqr1T8f4MMXrNpWsW_w6YiPjU5$> Also these methods in the compute module. https://arrow.apache.org/docs/python/api/compute.html#selecting-multiplexing<https://urldefense.com/v3/__https://arrow.apache.org/docs/python/api/compute.html*selecting-multiplexing__;Iw!!KSjYCgUGsB4!cvBXun8VADWdMPHICK36UXk7SCwLLS9c0pMC18SIcA2Sk2W21DsColPqr1T8f4MMXrNpWsW_w-slSjC8$> https://arrow.apache.org/docs/python/api/compute.html#selections<https://urldefense.com/v3/__https://arrow.apache.org/docs/python/api/compute.html*selections__;Iw!!KSjYCgUGsB4!cvBXun8VADWdMPHICK36UXk7SCwLLS9c0pMC18SIcA2Sk2W21DsColPqr1T8f4MMXrNpWsW_w-cd4a01$> Not at my computer, so apologies for not giving a direct example. I think coalesce might be the method you need. On Mon, Jul 4, 2022 at 12:44 PM H G <[email protected]<mailto:[email protected]>> wrote: iloc equivalent for selection by position and setting values? import pyarrow as pa import pandas as pd df = pd.DataFrame({'year': [2020, 2022, 2019, 2021], 'n_legs': [2, 4, 5, 100], 'animals': ["Flamingo", "Horse", "Brittle stars", None]}) table = pa.Table.from_pandas(df) df.loc[df["animals"].isnull(), "animals"] = "new_value" # how do we perform this in pyarrow? I did open this on github, but I assume it is not the forum for queries. Thanks -- Michael This message may contain information that is confidential or privileged. If you are not the intended recipient, please advise the sender immediately and delete this message. See http://www.blackrock.com/corporate/compliance/email-disclaimers for further information. Please refer to http://www.blackrock.com/corporate/compliance/privacy-policy for more information about BlackRock’s Privacy Policy. For a list of BlackRock's office addresses worldwide, see http://www.blackrock.com/corporate/about-us/contacts-locations. © 2022 BlackRock, Inc. All rights reserved.
