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 DataFrame from scratch

To use a DataFrame we first need to import pandas and set some options for output.

In [1]:
   # reference NumPy and pandas
   import numpy as np
   import pandas as pd

   # Set some pandas options
   pd.set_option('display.notebook_repr_html', False)
   pd.set_option('display.max_columns', 10)
   pd.set_option('display.max_rows', 10)

There are several ways to create a DataFrame. Probably the most straightforward way, is by creating it from a NumPy array. The following code creates a DataFrame from a two dimensional NumPy array.

In [2]:
   # create a DataFrame from a 2-d ndarray
   pd.DataFrame(np.array([[10, 11], [20, 21]]))

Out[2]:
       0   1
   0  10  11
   1  20  21

Each row of the array forms a row in the DataFrame object. Since we did not specify an index, pandas creates a default int64 index in the same manner as a Series object. Since we did not specify column names, pandas also assigns the names for each column with...

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