Learning Pandas content validity
Learning Pandas Catalog
Learning Pandas Wonderful Digest
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.This learner’s guide will help you understand how to use the features of pandas for interactive data manipulation and analysis.This book is your ideal guide to learning about pandas, all the way from installing it to creating one- and two-dimensional indexed data structures, indexing and slicing-and-dicing that data to derive results, loading data from local and Internet-based resources, and finally creating effective visualizations to form quick insights. You start with an overview of pandas and NumPy and then dive into the details of pandas, covering pandas’ Series and DataFrame objects, before ending with a quick review of using pandas for several problems in finance.With the knowledge you gain from this book, you will be able to quickly begin your journey into the exciting world of data science and analysis.Learning pandasCreditsAbout the AuthorAbout the Reviewerswww.PacktPub.comSupport files, eBooks, discount offers, and moreWhy subscribe?Free access for Packt account holdersPrefaceWhat this book coversWhat you need for this bookWho this book is forConventionsReader feedbackCustomer supportDownloading the example codeDownloading the color images of this bookErrataPiracyQuestions1. A Tour of pandaspandas and why it is importantpandas and IPython NotebooksReferencing pandas in the applicationPrimary pandas objectsThe pandas Series objectThe pandas DataFrame objectLoading data from files and the WebLoading CSV data from filesLoading data from the WebSimplicity of visualization of pandas dataSummary2. Installing pandasGetting AnacondaInstalling AnacondaInstalling Anaconda on LinuxInstalling Anaconda on Mac OS XInstalling Anaconda on WindowsEnsuring pandas is up to dateRunning a small pandas sample in IPythonStarting the IPython Notebook serverInstalling and running IPython NotebooksUsing Wakari for pandasSummary3. NumPy for pandasInstalling and importing NumPyBenefits and characteristics of NumPy arraysCreating NumPy arrays and performing basic array operationsSelecting array elementsLogical operations on arraysSlicing arraysReshaping arraysCombining arraysSplitting arraysUseful numerical methods of NumPy arraysSummary4. The pandas Series ObjectThe Series objectImporting pandasCreating SeriesSize, shape, uniqueness, and counts of valuesPeeking at data with heads, tails, and takeLooking up values in SeriesAlignment via index labelsArithmetic operationsThe special case of Not-A-Number (NaN)Boolean selectionReindexing a SeriesModifying a Series in-placeSlicing a SeriesSummary5. The pandas DataFrame ObjectCreating DataFrame from scratchExample dataS&P 500Monthly stock historical pricesSelecting columns of a DataFrameSelecting rows and values of a DataFrame using the indexSlicing using the  operatorSelecting rows by index label and location: .loc and .ilocSelecting rows by index label and/or location: .ixScalar lookup by label or location using .at and .iatSelecting rows of a DataFrame by Boolean selectionModifying the structure and content of DataFrameRenaming columnsAdding and inserting columnsReplacing the contents of a columnDeleting columns in a DataFrameAdding rows to a DataFrameAppending rows with .append()Concatenating DataFrame objects with pd.concat()Summarized data and descriptive statisticsSummary6. Accessing DataSetting up the IPython notebookCSV and Text/Tabular formatThe sample CSV data setReading a CSV file into a DataFrameSpecifying the index column when reading a CSV fileData type inference and specificationSpecifying column namesSpecifying specific columns to loadSaving DataFrame to a CSV fileGeneral field-delimited dataHandling noise rows in field-delimited dataReading and writing data in an Excel formatReading and writing JSON filesReading HTML data from the WebReading and writing HDF5 format filesAccessing data on the web and in the cloudReading and writing from/to SQL databasesReading data from remote data servicesReading stock data from Yahoo! and Google FinanceAdding rows (and columns) via setting with enlargementRemoving rows from a DataFrameRemoving rows using .drop()Removing rows using Boolean selectionRemoving rows using a sliceChanging scalar values in a DataFrameArithmetic on a DataFrameResetting and reindexingHierarchical indexingRetrieving data from Yahoo! Finance OptionsReading economic data from the Federal Reserve Bank of St. LouisAccessing Kenneth French’s dataReading from the World BankSummary7. Tidying Up Your DataWhat is tidying your data?Setting up the IPython notebookWorking with missing dataDetermining NaN values in Series and DataFrame objectsSelecting out or dropping missing dataHow pandas handles NaN values in mathematical operationsFilling in missing dataForward and backward filling of missing valuesFilling using index labelsInterpolation of missing valuesHandling duplicate dataTransforming DataMappingReplacing valuesApplying functions to transform dataSummary8. Combining and Reshaping DataSetting up the IPython notebookConcatenating dataMerging and joining dataAn overview of mergesSpecifying the join semantics of a merge operationPivotingStacking and unstackingStacking using nonhierarchical indexesUnstacking using hierarchical indexesMeltingPerformance benefits of stacked dataSummary9. Grouping and Aggregating DataSetting up the IPython notebookThe split, apply, and combine (SAC) patternSplitData for the examplesGrouping by a single column’s valuesAccessing the results of groupingGrouping using index levelsApplyApplying aggregation functions to groupsThe transformation of group dataAn overview of transformationPractical examples of transformationFiltering groupsDiscretization and BinningSummary10. Time-series DataSetting up the IPython notebookRepresentation of dates, time, and intervalsThe datetime, day, and time objectsTimestamp objectsTimedeltaIntroducing time-series dataDatetimeIndexCreating time-series data with specific frequenciesCalculating new dates using offsetsDate offsetsAnchored offsetsRepresenting durations of time using Period objectsThe Period objectPeriodIndexHandling holidays using calendarsNormalizing timestamps using time zonesManipulating time-series dataShifting and laggingFrequency conversionUp and down resamplingTime-series moving-window operationsSummary11. VisualizationSetting up the IPython notebookPlotting basics with pandasCreating time-series charts with .plot()Adorning and styling your time-series plotAdding a title and changing axes labelsSpecifying the legend content and positionSpecifying line colors, styles, thickness, and markersSpecifying tick mark locations and tick labelsFormatting axes tick date labels using formattersCommon plots used in statistical analysesBar plotsHistogramsBox and whisker chartsArea plotsScatter plotsDensity plotThe scatter plot matrixHeatmapsMultiple plots in a single chartSummary12. Applications to FinanceSetting up the IPython notebookObtaining and organizing stock data from Yahoo!Plotting time-series pricesPlotting volume-series dataCalculating the simple daily percentage changeCalculating simple daily cumulative returnsResampling data from daily to monthly returnsAnalyzing distribution of returnsPerforming a moving-average calculationThe comparison of average daily returns across stocksThe correlation of stocks based on the daily percentage change of the closing priceVolatility calculationDetermining risk relative to expected returnsSummaryIndexpandas and IPython NotebooksA popular means of using pandas is through the use of IPython Notebooks. IPython Notebooks provide a web-based interactive computational environment, allowing the combination of code, text, mathematics, plots, and right media into a web-based document. IPython Notebooks run in a browser and contain Python code that is run in a local or server-side Python session that the notebooks communicate with using WebSockets. Notebooks can also contain markup code and rich media content, and can be converted to other formats such as PDF, HTML, and slide shows.