Python Forum

Full Version: AttributeError: 'numpy.int32' object has no attribute 'split'
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi everyone,

I get the error "AttributeError: 'numpy.int32' object has no attribute 'split'" in all codes that contain UTCDateTime functions I use. What does it mean? How can solve this problem?

Thank you.
Hi! As per the error description, given by you, an integer cannot be split until it is converted to a string.
however, you can post the code snippet where you encounter the error for further doubt clearance.
(Jun-23-2022, 11:22 AM)Anushka00 Wrote: [ -> ]Hi! As per the error description, given by you, an integer cannot be split until it is converted to a string.
however, you can post the code snippet where you encounter the error for further doubt clearance.

from obspy.io.xseed import Parser
from obspy.signal import PPSD
from obspy.clients.fdsn import Client
from obspy import UTCDateTime
from obspy.imaging.cm import pqlx
import warnings
warnings.filterwarnings('ignore')

net = 'TU'
sta = 'BIRL'
loc = '*'
chan = '*HZ'
time = UTCDateTime(2022, 5, 23, 20, 00, 00)
wf_starttime = UTCDateTime(2022, 5, 20, 00, 00, 00)
wf_endtime = UTCDateTime(2022, 5, 23, 00, 00, 00)
Hi,
I using PyCharm editor for python code write.
When I write
from obspy import UTCDateTime
in Python Console, I receive error message as below:
AttributeError: 'numpy.int32' object has no attribute 'split'
Hi! it must be some other line of code that is raising the error. The given code snippet runs absolutely fine.
(Jun-24-2022, 07:32 AM)Anushka00 Wrote: [ -> ]Hi! it must be some other line of code that is raising the error. The given code snippet runs absolutely fine.

Hi,
Yes, you are right. Because the problem is not related to code. The problem is related to obspy library. when I write
from obspy import UTCDateTime
in Python Console, I receive same error message. There for I removed obspy library and reinstall. The problem is solved.
Thank you for your interest.
Glad you could resolve the error!