- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 507 Articles for Pandas
![Gireesha Devara](https://www.tutorialspoint.com/assets/profiles/397483/profile/60_1063327-1637125522.jpg)
122 Views
The pandas Series.factorize() method is used to encode the series object as an enumerated type or categorical variable. This method generates the numeric representation of the series data.The output of this Series.factorize() method is a tuple and it has two elements one is indicating codes and another element indicates uniques.Example 1In the following example, we will see how the series.factorize() method encodes the elements of the series object.# importing pandas package import pandas as pd # create a series s = pd.Series({'A':"aa", 'B':"bb", "C":"cc"}) print(s) result = s.factorize() print(result)ExplanationHere the series object is created by using a python ... Read More
![Gireesha Devara](https://www.tutorialspoint.com/assets/profiles/397483/profile/60_1063327-1637125522.jpg)
1K+ Views
If some of the elements in the series object have lists, then we can unnest those list elements into multiple rows of the series object. Unnesting is nothing but exploding the lists into rows.So this transformation can be done easily with the help of the pandas series.explode() method. This method is used to transform list-like elements of a series object into rows, and the index will be duplicated for these rows.The ignore_index is the only parameter for this method and it takes boolean values, False is the default one, and True means the resulting index will be labeled from 0 ... Read More
![Gireesha Devara](https://www.tutorialspoint.com/assets/profiles/397483/profile/60_1063327-1637125522.jpg)
2K+ Views
It is very common to have missing values in a series object, and if you want to compare that type of series objects then the ordinary comparison does not work because nan != nan, In that case, we can use the equals() method. The equals() method considers Nan’s in the same location to be equal.The fundamental operation of the pandas series.equals() method is used to compare two series for equality. it returns True if the two series have the same elements and shape, and returns False if the two series are unequal.Example 1In the following example, two series objects series1 ... Read More
![Gireesha Devara](https://www.tutorialspoint.com/assets/profiles/397483/profile/60_1063327-1637125522.jpg)
91 Views
The basic operation of the series.equals() method in the pandas constructor is used to test whether the elements in two series objects are the same or not, and it also compares the shape of the two series object.The equals() method is very similar to the pandas series.eq() method but the difference is it will return a boolean value as a result, whereas the eq() method returns a series object with boolean values.The output boolean value True indicates the elements in two series objects are the same. And it indicates False for unequal elements in series objects.Example 1In the following example, ... Read More
![Gireesha Devara](https://www.tutorialspoint.com/assets/profiles/397483/profile/60_1063327-1637125522.jpg)
389 Views
The Pandas series.eq() method is used to compare every element of a given series with a passed parameter (other series object or a scalar value). It will return True for every element which is equal to the element in the other series object (passed series object).The output of the eq() method is a series with boolean values and it performs an element-wise comparison operation which is nothing but caller series = other series. In the resultant series, the True value indicates the equivalent value in the other series object as well as, the False value indicates an unequal value.Handling of ... Read More
![Gireesha Devara](https://www.tutorialspoint.com/assets/profiles/397483/profile/60_1063327-1637125522.jpg)
88 Views
The series.eq() method in the pandas constructor is used to compare elements of the given series with others (maybe another series or a scalar value). As a result, It will return a new series object with boolean values.The element-wise equal operation is done by using this eq() method. The boolean value True represents the equivalent value in the second series object. And remaining unequal values are represented by the boolean value False.The parameters of the eq() method are other, fill_value, and level.Example 1In the following example, we will see how the eq() method compares elements of a series object with ... Read More
![Gireesha Devara](https://www.tutorialspoint.com/assets/profiles/397483/profile/60_1063327-1637125522.jpg)
2K+ Views
By using the duplicated() method in the pandas series constructor we can easily identify the duplicate values in the index of a series object. The method duplicated() is used to identify the duplicate values in a series object.The duplicated() method will return a series with boolean values. Boolean value False indicates single occurrence values mean unique values. The duplicated values are indicated with boolean value True.Example 1Here we will see how we can delete the rows of a series object with duplicate indices.# importing pandas package import pandas as pd #create series series = pd.Series(["a", "b", "c", "d", "e"], ... Read More
![Gireesha Devara](https://www.tutorialspoint.com/assets/profiles/397483/profile/60_1063327-1637125522.jpg)
96 Views
Finding the duplicate values in an object is a very common task in the data analysis process. In pandas, we have a function called duplicated() which is used to identify the duplicate values.For a pandas series object, the duplicated() method will return a series with boolean values. True indicates duplicate values only for the last occurrence values or the first occurrence values or it may indicate all the duplicate values.The duplicated() method has a parameter called “keep” which is used to treat the duplicate values differently. The default behavior of this parameter is “first” which means it marks all the ... Read More
![Gireesha Devara](https://www.tutorialspoint.com/assets/profiles/397483/profile/60_1063327-1637125522.jpg)
226 Views
Reading and extracting valid information from a DateTime object is a very important task in data analysis. The pandas package provides some useful tools to perform feature extracting from a DateTime object.In pandas, the series.dt() method is used to access the components like years, months, days, etc., from a given time series.The series.dt() method has some attributes to extract the year, month, quarter, and day features. In the examples given below, we will use some of these attributes to extract features.Example 1You can see that we have created a pandas series with 10 different timestamps. Then, we accessed only the ... Read More
![Gireesha Devara](https://www.tutorialspoint.com/assets/profiles/397483/profile/60_1063327-1637125522.jpg)
370 Views
The drop_duplicate() method in the pandas series constructor is used to remove the duplicate values from a series object. This method cleans the duplicate values and returns a series with modified rows, and it won’t alter the original series object. Instead, it will return a new one.One of the important parameters in the drop_duplicates() method is “Keep”, the default value of this parameter is “first” which keeps the first occurrence value and deletes the remaining. We can also specify Last and False values to the keep parameter.If keep=False, it will delete all duplicate values. Or if keep= “Last”, it deletes ... Read More