Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Learning Pandas
  • Table Of Contents Toc
Learning Pandas

Learning Pandas

By : Michael Heydt
4.2 (10)
close
close
Learning Pandas

Learning Pandas

4.2 (10)
By: Michael Heydt

Overview of this book

If you are a Python programmer who wants to get started with performing data analysis using pandas and Python, this is the book for you. Some experience with statistical analysis would be helpful but is not mandatory.
Table of Contents (14 chapters)
close
close
13
Index

Creating NumPy arrays and performing basic array operations

A NumPy array can be created using multiple techniques. The following code creates a new NumPy array object from a Python list:

In [4]:
   # a simple array
   a1 = np.array([1, 2, 3, 4, 5])
   a1

Out[4]:
   array([1, 2, 3, 4, 5])

In [5]:
   # what is its type?
   type(a1)

Out[5]:
   numpy.ndarray

In [6]:
   # how many elements?
   np.size(a1)

Out[6]:
   5

In NumPy, n-dimensional arrays are denoted as ndarray, and this one contains five elements, as is reported by the np.size() function.

NumPy arrays must have all of their elements of the same type. If you specify different types in the list, NumPy will try to coerce all the items to the same type. The following code example demonstrates using integer and floating-point values to initialize the array, which are then converted to floating-point numbers by NumPy:

In [7]:
   # any float in the sequences makes
   # it an array of floats
   a2 = np.array([1, 2, 3, 4.0, 5.0])
   a2...
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Learning Pandas
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon