# zero-dimensional arrays cannot be concatenated ( Solved )

If you are using NumPy in your code and if you are getting ValueError: zero-dimensional arrays cannot be concatenated then this post is for you. In this entire tutorial, you will learn how to solve the issue of ValueError: zero-dimensional arrays cannot be concatenated in a simple way.

## What is the ValueError?

ValueError is an exception error in python. In most cases, you will get this error when inbuilt python operations or functions receive an argument that may be of the correct type. But the value of that variable is invalid. If you want to ignore this error then you can use the try-except block to continue the code. It will also let you get the information about the error.

## What causes the ValueError: zero-dimensional arrays cannot be concatenated?

The root cause of this zero-dimensional arrays cannot be concatenated is that you must be wrongly passing the value of the variable for the function. If you are using the NumPy then it provides numpy.concatenate() function to concatenate arrays.

You will get this ValueError when you will run the below lines of code.

``````import numpy as np
my_array = np.array([10,20,30,40,50])
array = np.concatenate(my_array)
print(array)``````

Output

## The solution of the zero-dimensional arrays cannot be concatenated

The solution for ValueError: zero-dimensional arrays cannot be concatenated is very simple. You can see in the above code I have passed the NumPy array as an argument to the np.concatenate function. But this function will tell the python interpreter that the argument is of invalid value. That’s why you are getting the ValueError.

Now to solve it you have pass the argument inside the square bracket. The function will not give you an error.

Run the below lines of code you will get the NumPy array as output.

``````import numpy as np
my_array = np.array([10,20,30,40,50])
array = np.concatenate([my_array],axis =0)
print(array)``````

Output

## Conclusion

ValueError is the error you will get when the type of argument of the variable is invalid. The error zero-dimensional arrays cannot be concatenated also occurs due to it. If you are getting this error then the above method will solve it.

I hope you have liked this tutorial. If you have any doubt then you can contact us for more help.