df.explode(['X'])
ValueError: column must be a scalar
Hi anyone could advice on this?
You can supply a list or tuple of column names, but only with pandas >= 1.3.0: see https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.explode.html
New in version 1.3.0: Multi-column explode
If you see this ValueError
you must be using an older version of pandas
Use df.explode('X')
instead of df.explode(['X'])
. Example on pandas explode page explains this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With