By using the lambda operator
This syntax is generally used to apply log transformations and normalize the data to bring it in the range of 0 to 1 for particular columns of the data.
Python3
const = data_frame[ 'Age' ]. max () data_frame[ 'Age' ] = data_frame[ 'Age' ]. apply ( lambda x: x / const) data_frame.head() |
Output:
CustomerID Genre Age Annual Income (k$) Spending Score (1-100) \
0 1 Male 0.271429 15 39
1 2 Male 0.300000 15 81
2 3 Female 0.285714 16 6
3 4 Female 0.328571 16 77
4 5 Female 0.442857 17 40
NewColumn Customer Satisfaction
0 1 No
1 1 Yes
2 1 No
3 1 Yes
4 1 No
Data Processing with Pandas
Data Processing is an important part of any task that includes data-driven work. It helps us to provide meaningful insights from the data. As we know Python is a widely used programming language, and there are various libraries and tools available for data processing.
In this article, we are going to see Data Processing in Python, Loading, Printing rows and Columns, Data frame summary, Missing data values Sorting and Merging Data Frames, Applying Functions, and Visualizing Dataframes.
Table of Content
- What is Data Processing in Python?
- What is Pandas?
- Loading Data in Pandas DataFrame
- Printing rows of the Data
- Printing the column names of the DataFrame
- Summary of Data Frame
- Descriptive Statistical Measures of a DataFrame
- Missing Data Handing
- Sorting DataFrame values
- Merge Data Frames
- Apply Function
- By using the lambda operator
- Visualizing DataFrame
- Conclusion
Contact Us