The problem poped up when I try to use function awkward.load(), but there comes the message "module 'awkward' has no attribute 'load'", and I think the problem is that the newest version of awkward just delete this attribute, but I cannot find any alternative solution. Does anyone know how to fix it? The version of awkward is 2.4.3
I've already import the module.
You're right, the
awkward.loadfunction is part of the Awkward 0.x interface, and you're using Awkward 2.x. The serialization format used in Awkward 0.x is no longer supported. Since Awkward 1.0.1 (December 2020), the pickle format has been kept backward-compatible.Since you're trying to load files, I can tell you there is a way to do it across the three major versions. A package named
awkward0can be installed and imported alongside other versions of Awkward Array. You can use that toloadthe data from the 0.x file format. Awkward 1.x has anawkward.from_awkward0function that can turn an Awkward 0 array in memory into an Awkward 1 array in memory. Then pickle that array in a file and load it into a Python process that has Awkward 2 installed. Awkward 1 and Awkward 2 can't both be installed in the same Python environment, because they're just two versions of the same package. (That's normally the case for Python packages, and the trick we pulled with makingawkward0a package on its own caused other problems.)But be aware that this is not the only interface change. In each major version of a software package, semantic versioning allows for interface changes. The interface changes from Awkward 0 to Awkward 1 were significant. The above technique, complicated though it is, will allow you to restore all the data, but code needs to be updated if you're going to use the new version.