Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
numpy.str bytes issue
#1
I'm currently using Vizier Query to call the SAO catalog. I've successfully created a script that calls each spectral type, but when I try to plot the B stars, it comes up with this:

startswith first arg must be bytes or a tuple of bytes, not numpy.str_

The code that it refers to is

tbl = tbl[tbl['SpType'] != '']
print(tbl['_RA.icrs'][:4])
print(tbl['_DE.icrs'][:4])
sptype_mask = np.char.startswith(tbl['SpType'], 'O')

I'm unsure how to change the code to get it working. The rest of the script runs perfectly, and the mollweide projection works fine, I just can't plot each spectral type.

Has anybody had this issue with their code?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [Numpy] How to store different data type in one numpy array? water 7 537 Mar-26-2024, 02:18 PM
Last Post: snippsat
  Numpy returns "TypeError: unsupported operand type(s) for *: 'numpy.ufunc' and 'int'" kalle 2 2,598 Jul-19-2022, 06:31 AM
Last Post: paul18fr
  memory issue loading movie to numpy array djf123 1 2,289 Nov-07-2019, 06:19 AM
Last Post: ThomasL
  "erlarge" a numpy-matrix to numpy-array PhysChem 2 2,976 Apr-09-2019, 04:54 PM
Last Post: PhysChem
  issue with numpy.savetxt alyssaantarctica 1 3,940 Jul-13-2018, 03:50 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020