Created
October 3, 2020 23:52
-
-
Save PrudhviVajja/b2a87550ccc9ad1e6eb94df82339b2ff to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"import pandas as pd\n", | |
"import warnings\n", | |
"warnings.filterwarnings(\"ignore\")" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"df = pd.read_csv(\"train.csv\")" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 5, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"<class 'pandas.core.frame.DataFrame'>\n", | |
"RangeIndex: 401125 entries, 0 to 401124\n", | |
"Columns: 53 entries, SalesID to Steering_Controls\n", | |
"dtypes: float64(2), int64(6), object(45)\n", | |
"memory usage: 815.8 MB\n" | |
] | |
} | |
], | |
"source": [ | |
"df.info(verbose=False, memory_usage=\"deep\")" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 6, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"53" | |
] | |
}, | |
"execution_count": 6, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"len(df.columns)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 7, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"40" | |
] | |
}, | |
"execution_count": 7, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"req_cols = ['SalesID', 'SalePrice', 'MachineID', 'ModelID', 'datasource',\n", | |
" 'auctioneerID', 'YearMade', 'MachineHoursCurrentMeter', 'UsageBand',\n", | |
" 'saledate', 'fiModelDesc', 'fiBaseModel', 'fiSecondaryDesc',\n", | |
" 'fiModelSeries', 'fiModelDescriptor', 'ProductSize',\n", | |
" 'fiProductClassDesc', 'state', 'ProductGroup', 'ProductGroupDesc',\n", | |
" 'Drive_System', 'Enclosure', 'Forks', 'Pad_Type', 'Ride_Control',\n", | |
" 'Stick', 'Transmission', 'Turbocharged', 'Blade_Extension',\n", | |
" 'Blade_Width', 'Enclosure_Type', 'Engine_Horsepower', 'Hydraulics',\n", | |
" 'Pushblock', 'Ripper', 'Scarifier', 'Tip_Control', 'Tire_Size',\n", | |
" 'Coupler', 'Coupler_System']\n", | |
"len(req_cols)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 8, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"df = pd.read_csv(\"train.csv\", usecols=req_cols)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 9, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"<class 'pandas.core.frame.DataFrame'>\n", | |
"RangeIndex: 401125 entries, 0 to 401124\n", | |
"Columns: 40 entries, SalesID to Coupler_System\n", | |
"dtypes: float64(2), int64(6), object(32)\n", | |
"memory usage: 618.3 MB\n" | |
] | |
} | |
], | |
"source": [ | |
"df.info(verbose=False, memory_usage=\"deep\")" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.7.7" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 4 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment