Python for Data Analysis: A Step-By-Step Guide to Master the Basics of Data Science and Analysis in Python Using Pandas, Numpy And Ipython (Data Science Mastery Book 2) by Park Andrew
Author:Park, Andrew [Park, Andrew]
Language: eng
Format: epub
Published: 2020-07-05T16:00:00+00:00
Chapter 6
Pandas
Pandas are built on NumPy and they are meant to be used together. This makes it extremely easy to extract arrays from the data frames. Once these arrays are extracted, they can be turned into data frames themselves. Let’s take a look at an example:
In: import pandas as pd
import numpy as np
marketing_filename = 'regression-datasets-marketing.csv'
marketing = pd.read_csv(marketing _filename, header=None)
In this phase, we are uploading data to a data frame. Next, we’re going to use the “values” method to extract an array that is of the same type as those contained inside the data frame.
In: marketing_array = marketing.values
marketing_array.dtype
Out: dtype('float64')
We can see that we have a float type array. You can anticipate the type of the array by first using the “dtype” method. This will establish which types are being used by the specified data frame object. Do this before extracting the array. This is how this operation would look:
In: marketing.dtypes
Out: 0float64
1int64
2float64
3int64
4float64
5float64
6float64
7float64
8int64
9int64
10int64
11float64
12float64
13float64
dtype: object
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Access | Data Mining |
Data Modeling & Design | Data Processing |
Data Warehousing | MySQL |
Oracle | Other Databases |
Relational Databases | SQL |
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(7864)
Learning SQL by Alan Beaulieu(5428)
Weapons of Math Destruction by Cathy O'Neil(5050)
Big Data Analysis with Python by Ivan Marin(3108)
Blockchain Basics by Daniel Drescher(2899)
Building Statistical Models in Python by Huy Hoang Nguyen & Paul N Adams & Stuart J Miller(2666)
Azure Data and AI Architect Handbook by Olivier Mertens & Breght Van Baelen(2634)
Serverless Machine Learning with Amazon Redshift ML by Debu Panda & Phil Bates & Bhanu Pittampally & Sumeet Joshi(2572)
Hands-On Machine Learning for Algorithmic Trading by Stefan Jansen(2545)
Pandas Cookbook by Theodore Petrou(2509)
Mastering Python for Finance by Unknown(2494)
Data Wrangling on AWS by Navnit Shukla | Sankar M | Sam Palani(2353)
How The Mind Works by Steven Pinker(2224)
Driving Data Quality with Data Contracts by Andrew Jones(2217)
Data Engineering with dbt by Roberto Zagni(2174)
Building Machine Learning Systems with Python by Richert Willi Coelho Luis Pedro(2061)
Machine Learning Model Serving Patterns and Best Practices by Md Johirul Islam(2015)
Network Science with Python and NetworkX Quick Start Guide by Edward L. Platt(2012)
Python Natural Language Processing by Jalaj Thanaki(1896)