Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1. Load CSV into DataFrame: df = pd.read_csv('filename.csv')
- 2. Get Shape (Number of Rows and Columns): df.shape
- 3. Get Summary Information: df.info()
- 4. Displaying the First Few Rows of the DataFrame: df.head(10)
- 5. List Column Names: df.columns
- 6. Access a Specific Column: df['ColumnName'] # Example: f['Country name']
- 7. Access Specific Row by Index: df.iloc[index] # Example: f.iloc[4]
- 8. Filter Rows by Condition: df[df['ColumnName'] == 'Value'] # Example: f[df['Continent'] == 'Asia']
- 9. Save Filtered Data to CSV: df[df['Continent'] == 'Asia'].to_csv('asia.csv', index=False)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement