Pandas is a fast, powerful, flexible and open source data analysis and manipulation tool.

A Mega thread 🧵covering 10 amazing Pandas hacks and how to efficiently use it(with Code Implementation)👇🏻
#Python #DataScientist #Programming #MachineLearning #100DaysofCode #DataScience
1/ Indexing data frames
Indexing means to selecting all/particular rows and columns of data from a DataFrame. In pandas it can be done using two constructs —
.loc() : location based
It has methods like scalar label, list of labels, slice object etc
.iloc() : Interger based
2/ Slicing data frames
In order to slice by labels you can use loc() attribute of the DataFrame.

Implementation —
3/ Filtering data frames
Using Filter you can subset rows or columns of dataframe according to labels in the specified index of the data.

Implementation —
4/ Transforming Data Frames
Pandas Transform helps in creating a DataFrame with transformed values and has the same axis length as its own.

Implementation —
5/ Adding Rows — append()

Implementation —
6. Hierarchical indexing
Hierarchical indexing is the technique in which we set more than one column name as the index. set_index() function is used for when doing hierarchical indexing.

Implementation —
7/ Merging data frames
Concat() Function is used to merge the dataframes.

Implementation --
8/ Joins —
It helps us merging DataFrames. Types of Joins —
Inner Join :- Returns records that have matching values in both tables.
Left Join :- Returns all the rows from the left table that are specified in the left outer join clause, not just the rows in which the columns match
9/ Right Join :- Returns all records from the right table, and the matched records from the left table.
Full Join :- Returns all records when there is a match in either left or right table.
Cross Join :- Returns all possible combinations of rows from two tables.

Implementation-
10/ Pivot Tables
It creates a Spreadsheet style pivot table as a DataFrame.

Implementation -
11/ Aggregate Functions
Pandas has a number of aggregating functions that reduce the dimension of the grouped object.
count()
value_count()
mean()
median()
sum()
min()
max()
std()
var()
describe()
sem()

Implementation -
12/ I write quality threads on Data Science, Python, Programming, Machine Learning and AI in my free time. If you like this thread, then give a follow.
13/ Want to learn complete hands on #Python with Code Implementation? Try this ( 89% off) :
udemy.com/course/complet…
14/ 11 Amazing Data Science Techniques You Should Know!
With Code Implementation.
15/ 10 Efficient Code and Optimization techniques for Python with Code Implementation.

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Naina Chaturvedi

Naina Chaturvedi Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @NainaChaturved8

23 Sep
Projects Alert : 140 Python Projects with Source Code
You don't have to go to a university or pay hefty tuition to learn ML when you can learn for FREE.

An extensive list of 100+ Most Valuable Github Repository for ML, beginner to advanced.
theinsaneapp.com/2021/09/best-g…
#Python #DataScientist #Programming #Machinelearning #100DaysofCode
Read 5 tweets
20 Sep
10 Amazing Advanced Python Constructs that you can use to write efficient and clean Code
A Thread 🧵👇🏻
#Python #TensorFlow #DataScientist #Programming #Coding #100DaysofCode #DataScience #AI #MachineLearning
1/ DefaultDict
In python, a dictionary is a container that holds key-value pairs. Keys must be unique, immutable objects. If you try to access or modify keys that don’t exist in the dictionary, it raise a KeyError & break up your code execution ( continued..)
2/ (Continued..)To tackle this issue,Python defaultdict type, a dictionary-like class is used.If you try to access or modify a missing key,then defaultdict will automatically create the key & generate a default value for it
A defaultdict will never raise a KeyError ( Continued..)
Read 18 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!

:(