python convert between list numpy array and pandas series

Solutions on MaxInterview for python convert between list numpy array and pandas series by the best coders in the world

showing results for - "python convert between list numpy array and pandas series"
Mariana
07 Apr 2020
1# Basic syntax:
2array = numpy.array(list) 	# Convert list to NumPy array
3list = array.tolist()		# Convert NumPy array to list
4series = pandas.series(list) # Convert list to Pandas series
5list = series.tolist()		# Convert Pandas series to list
6array = series.to_numpy()	# Convert Pandas series to NumPy array
7series = pandas.Series(array) # Convert NumPy array to Pandas series
8
9# Note, you need to import the NumPy and Pandas packages for this to work