0% found this document useful (0 votes)
3 views4 pages

Excel Python PDF

The document provides a comprehensive guide on data manipulation techniques using both Pandas and Excel. It covers tasks such as reading data, filtering, grouping, merging datasets, and performing calculations. Each task is presented with corresponding commands for both tools, facilitating easy reference for users familiar with either platform.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views4 pages

Excel Python PDF

The document provides a comprehensive guide on data manipulation techniques using both Pandas and Excel. It covers tasks such as reading data, filtering, grouping, merging datasets, and performing calculations. Each task is presented with corresponding commands for both tools, facilitating easy reference for users familiar with either platform.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1.

Read Data from a CSV File:


● Pandas: pd.read_csv('[Link]')
● Excel: Data > From Text/CSV

2. View the First Few Rows of Data:


● Pandas: [Link]()
● Excel: Scroll to view manually or use filters

3. Filter Data:
● Pandas: df[df['column'] > 10]
● Excel: Home > Sort & Filter > Filter > Filter by Condition

4. Select Specific Columns:


● Pandas: df[['col1', 'col2']]
● Excel: Click and drag to select columns

5. Remove Missing Values:


● Pandas: [Link]()
● Excel: Home > Find & Select > Go To Special > Blanks > Delete

6. Fill Missing Values:


● Pandas: [Link](value)
● Excel: Select cells > Home > Find & Select > Replace > Find what:
"" > Replace with: value
7. Group and Aggregate Data:
● Pandas: [Link]('column').sum()
● Excel: Insert > PivotTable > Drag fields to Rows/Columns/Values

8. Merge Datasets:
● Pandas: [Link](df1, df2, on='key')
● Excel: Data > Get & Transform > Merge Queries

9. Add New Column Based on Existing Columns:


● Pandas: df['new_col'] = df['col1'] + df['col2']
● Excel: Select cell > Type formula (e.g., =A1 + B1) > Drag to fill

10. Remove Duplicate Rows:


● Pandas: df.drop_duplicates()
● Excel: Data > Remove Duplicates

11. Sort Data:


● Pandas: df.sort_values(by='column')
● Excel: Home > Sort & Filter > Sort

12. Rename Columns:


● Pandas: [Link](columns={'old_name': 'new_name'})
● Excel: Double-click column header > Type new name
13. Calculate Summary Statistics:
● Pandas: [Link]()
● Excel: Formulas > More Functions > Statistical

14. Count Number of Rows:


● Pandas: [Link][0]
● Excel: =COUNTA(A:A)

15. Apply Function to Each Element:


● Pandas: df['column'].apply(lambda x: x * 2)
● Excel: Select cells > Use a formula (e.g., =A1*2) > Drag to fill

16. Extract Year from Date:


● Pandas: df['year'] = df['date'].[Link]
● Excel: =YEAR(A1)

17. Concatenate Text Columns:


● Pandas: df['new_col'] = df['col1'] + ' ' + df['col2']
● Excel: =CONCATENATE(A1, " ", B1) or =A1 & " " & B1

18. Find Unique Values:


● Pandas: df['column'].unique()
● Excel: Data > Remove Duplicates > Copy to another location
19. Create a Pivot Table:
● Pandas: df.pivot_table(values='val', index='idx', columns='col')
● Excel: Insert > PivotTable

20. Basic Mathematical Operations:


● Pandas: df['sum'] = df['col1'] + df['col2']
● Excel: =A1 + B1

You might also like