Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Python
  3. Question
Python

How to add an integer to python array?

Asked by Aryan Khan Apr 17, 2021 1.1K views 1 answer
Share

About this question

I am trying to add an integer to an already existing array. But I am getting error “numpy.ndarray' object has no attribute 'append'”:

 "AttributeError: 'numpy.ndarray' object has no attribute 'append'"

This is the code I am using:

import numpy as np

data = np.array(f['abc']['efg']['xyz'])

data.append(0)

Your answer

1 Answer

More Python discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Python Blogs

Guides, tips and career advice on Python from JanBask experts.