0% found this document useful (0 votes)
13 views6 pages

Cheatsheet Panda

Python

Uploaded by

Reza Ahmed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
13 views6 pages

Cheatsheet Panda

Python

Uploaded by

Reza Ahmed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 6
‘Data Exploration using Pandas | CHEATSHEET 2. Reading a CSV filo eal Writing content of data frame to CSV fle » «Reading an Excel le 4. writing content of data frame to Excel fle Se ee) 2.Getting Preview of Dataframe ‘2. Looking at top n records b. Looking at bottom n records . View columns name ‘2, Rename method helps to rename column of data frame. i eolunnmame “new. coke) This statemont will create a new data frame with new column name. bb To rename the column of existing data frame, sot inplace=True. a ename(colunns=(od_cokmaname’: new columnname) npace= Tue) 4, Selecting Columns or Rows (eee ee En) aS he This i an inevtale pat of dealing with data. To overcome this hurdle, use cease mee feet ee eel eee eee emer fina: te used to fl missing values ESUAIENEIIE 11 roptaco al missing values with 5 ‘lt replaces all missing values of columnt with mean ‘of avallable values New column is a function of existing columns LETTE *creato a copy of existing column? SUMMIT) *Acc 10 to existing column2 then create a new one TUTTE) # Acc elements of columnt and column2 then create new column Groupby: Groupby helps to perform three operations |. Splitting the data into groups ‘Applying a function to each group individually i, Combining the result into a data structure a (“Gs It helps to genorate data structure. It has three components index, columns and values (similar to excel) ET eT cr hn argument aggfune ERT PERE 4t shows count ¢. Cross Tab: Cross Tab computes the simple cross tabulation of two factors. EER ES perertenmer rarer ates snr soe area ceeeel a aes eter eenee reer cette b. Merging: We can perform left, right and inner join also. pamergyat 2, on=eumnt’, eee eee eee eee ee) Applying function to element, column or dataframe ‘a, Map: It iterates over each element of a series. ‘this will add 10 to each element of columnt this will concatenate “AV" at the beginning of ‘each element of column? (column format is string) 'b. Apply: As the name suggests, applies a function along any axis of the DataFrame. CUMMEMET IN) #t will returns the sum of all the values of ‘columnt and column2. ¢. ApplyMap: This helps to apply a function to each oloment of dataframe. ‘twill add 2 to each element of dataframe (all columns of datatrame must be numeric type) Function unique helps to return unique values of a column. Pandas helps to understand the data using basie statistical methods, a. describe: This returns the quick stats (count, mean, std, min, first quartile, ‘median, third quartile, max) on suitable columns b. covariance: It returns the co-variance between suitable columns. . correlation: It retums the co-variance between suitable columns. Be er VEN ennai a eae ree Gries Pree ead For more resources on analytics / data science, visit www.analyticsvidhya.com Analytics Vidhya Lenser ne

You might also like