path
stringlengths
13
17
screenshot_names
sequencelengths
1
873
code
stringlengths
0
40.4k
cell_type
stringclasses
1 value
130007434/cell_13
[ "text_plain_output_1.png" ]
import pandas as pd dataset_path = '/kaggle/input/hr-analytics-and-job-prediction/HR_comma_sep.csv' hr = pd.read_csv(dataset_path) hr.columns hr.columns = hr.columns.str.lower() hr.columns = hr.columns.str.replace(' ', '_') hr.columns = hr.columns.str.replace('\\W', '_', regex=True) hr.columns hr.isna().sum() duplicates_mask = hr.duplicated() duplicates = hr[duplicates_mask] duplicates.shape hr.duplicated().sum() hr_no_duplicates = hr.drop_duplicates() hr_no_duplicates hr_no_duplicates.describe()
code
130007434/cell_9
[ "text_plain_output_1.png", "image_output_1.png" ]
import pandas as pd dataset_path = '/kaggle/input/hr-analytics-and-job-prediction/HR_comma_sep.csv' hr = pd.read_csv(dataset_path) hr.columns hr.columns = hr.columns.str.lower() hr.columns = hr.columns.str.replace(' ', '_') hr.columns = hr.columns.str.replace('\\W', '_', regex=True) hr.columns hr.isna().sum()
code
130007434/cell_20
[ "text_html_output_1.png" ]
import matplotlib.pyplot as plt import pandas as pd import seaborn as sns dataset_path = '/kaggle/input/hr-analytics-and-job-prediction/HR_comma_sep.csv' hr = pd.read_csv(dataset_path) hr.columns hr.columns = hr.columns.str.lower() hr.columns = hr.columns.str.replace(' ', '_') hr.columns = hr.columns.str.replace('\\W', '_', regex=True) hr.columns hr.isna().sum() duplicates_mask = hr.duplicated() duplicates = hr[duplicates_mask] duplicates.shape hr.duplicated().sum() hr_no_duplicates = hr.drop_duplicates() hr_no_duplicates # Determine the number of rows containing outliers # create a boxplot of the 'time_spend_company' column _, flier_dict = hr_no_duplicates.boxplot(column='time_spend_company', return_type='both') # get the values of the outliers outliers = [flier.get_ydata()[0] for flier in flier_dict['fliers']] # select the rows that contain the outliers outlier_rows = hr_no_duplicates['time_spend_company'].isin(outliers) # count the number of rows that contain the outliers num_outliers = outlier_rows.sum() # print the number of rows that contain the outliers print('Number of rows containing outliers:', num_outliers) sns.pairplot(hr_no_duplicates)
code
130007434/cell_6
[ "text_plain_output_1.png", "image_output_1.png" ]
import pandas as pd dataset_path = '/kaggle/input/hr-analytics-and-job-prediction/HR_comma_sep.csv' hr = pd.read_csv(dataset_path) hr.describe()
code
130007434/cell_11
[ "text_plain_output_1.png" ]
import pandas as pd dataset_path = '/kaggle/input/hr-analytics-and-job-prediction/HR_comma_sep.csv' hr = pd.read_csv(dataset_path) hr.columns hr.columns = hr.columns.str.lower() hr.columns = hr.columns.str.replace(' ', '_') hr.columns = hr.columns.str.replace('\\W', '_', regex=True) hr.columns hr.isna().sum() duplicates_mask = hr.duplicated() duplicates = hr[duplicates_mask] duplicates.shape hr.duplicated().sum()
code
130007434/cell_1
[ "application_vnd.jupyter.stderr_output_1.png" ]
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns pd.set_option('display.max_columns', None) from xgboost import XGBClassifier from xgboost import XGBRegressor from xgboost import plot_importance from sklearn.linear_model import LogisticRegression from sklearn.tree import DecisionTreeClassifier from sklearn.ensemble import RandomForestClassifier from sklearn.model_selection import GridSearchCV, train_test_split from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score, confusion_matrix, ConfusionMatrixDisplay, classification_report from sklearn.metrics import roc_auc_score, roc_curve from sklearn.tree import plot_tree
code
130007434/cell_7
[ "text_plain_output_1.png", "image_output_1.png" ]
import pandas as pd dataset_path = '/kaggle/input/hr-analytics-and-job-prediction/HR_comma_sep.csv' hr = pd.read_csv(dataset_path) hr.columns
code
130007434/cell_18
[ "text_plain_output_1.png" ]
import matplotlib.pyplot as plt import pandas as pd dataset_path = '/kaggle/input/hr-analytics-and-job-prediction/HR_comma_sep.csv' hr = pd.read_csv(dataset_path) hr.columns hr.columns = hr.columns.str.lower() hr.columns = hr.columns.str.replace(' ', '_') hr.columns = hr.columns.str.replace('\\W', '_', regex=True) hr.columns hr.isna().sum() duplicates_mask = hr.duplicated() duplicates = hr[duplicates_mask] duplicates.shape hr.duplicated().sum() hr_no_duplicates = hr.drop_duplicates() hr_no_duplicates # Determine the number of rows containing outliers # create a boxplot of the 'time_spend_company' column _, flier_dict = hr_no_duplicates.boxplot(column='time_spend_company', return_type='both') # get the values of the outliers outliers = [flier.get_ydata()[0] for flier in flier_dict['fliers']] # select the rows that contain the outliers outlier_rows = hr_no_duplicates['time_spend_company'].isin(outliers) # count the number of rows that contain the outliers num_outliers = outlier_rows.sum() # print the number of rows that contain the outliers print('Number of rows containing outliers:', num_outliers) percentile25 = hr_no_duplicates['time_spend_company'].quantile(0.25) percentile75 = hr_no_duplicates['time_spend_company'].quantile(0.75) iqr = percentile75 - percentile25 print('IQR:', iqr) upper_limit = percentile75 + 1.5 * iqr lower_limit = percentile25 - 1.5 * iqr print('Lower limit:', lower_limit) print('Upper limit:', upper_limit) outliers = hr_no_duplicates[(hr_no_duplicates['time_spend_company'] > upper_limit) | (hr_no_duplicates['time_spend_company'] < lower_limit)] print('Number of rows in the data containing outliers in `time_spend_company`:', len(outliers))
code
130007434/cell_8
[ "text_plain_output_1.png" ]
import pandas as pd dataset_path = '/kaggle/input/hr-analytics-and-job-prediction/HR_comma_sep.csv' hr = pd.read_csv(dataset_path) hr.columns hr.columns = hr.columns.str.lower() hr.columns = hr.columns.str.replace(' ', '_') hr.columns = hr.columns.str.replace('\\W', '_', regex=True) hr.columns
code
130007434/cell_15
[ "text_plain_output_1.png" ]
import matplotlib.pyplot as plt import pandas as pd dataset_path = '/kaggle/input/hr-analytics-and-job-prediction/HR_comma_sep.csv' hr = pd.read_csv(dataset_path) hr.columns hr.columns = hr.columns.str.lower() hr.columns = hr.columns.str.replace(' ', '_') hr.columns = hr.columns.str.replace('\\W', '_', regex=True) hr.columns hr.isna().sum() duplicates_mask = hr.duplicated() duplicates = hr[duplicates_mask] duplicates.shape hr.duplicated().sum() hr_no_duplicates = hr.drop_duplicates() hr_no_duplicates hr_no_duplicates.boxplot(column='time_spend_company') plt.show()
code
130007434/cell_16
[ "text_plain_output_1.png" ]
import matplotlib.pyplot as plt import pandas as pd dataset_path = '/kaggle/input/hr-analytics-and-job-prediction/HR_comma_sep.csv' hr = pd.read_csv(dataset_path) hr.columns hr.columns = hr.columns.str.lower() hr.columns = hr.columns.str.replace(' ', '_') hr.columns = hr.columns.str.replace('\\W', '_', regex=True) hr.columns hr.isna().sum() duplicates_mask = hr.duplicated() duplicates = hr[duplicates_mask] duplicates.shape hr.duplicated().sum() hr_no_duplicates = hr.drop_duplicates() hr_no_duplicates fig, ax = plt.subplots() ax.boxplot(hr_no_duplicates['time_spend_company']) whiskers = ax.lines[2:4] whisker_values = [whisk.get_ydata()[1] for whisk in whiskers] print('Whisker values:', whisker_values)
code
130007434/cell_3
[ "text_html_output_1.png" ]
import pandas as pd dataset_path = '/kaggle/input/hr-analytics-and-job-prediction/HR_comma_sep.csv' hr = pd.read_csv(dataset_path) hr.head(10)
code
130007434/cell_17
[ "text_plain_output_1.png" ]
import matplotlib.pyplot as plt import pandas as pd dataset_path = '/kaggle/input/hr-analytics-and-job-prediction/HR_comma_sep.csv' hr = pd.read_csv(dataset_path) hr.columns hr.columns = hr.columns.str.lower() hr.columns = hr.columns.str.replace(' ', '_') hr.columns = hr.columns.str.replace('\\W', '_', regex=True) hr.columns hr.isna().sum() duplicates_mask = hr.duplicated() duplicates = hr[duplicates_mask] duplicates.shape hr.duplicated().sum() hr_no_duplicates = hr.drop_duplicates() hr_no_duplicates _, flier_dict = hr_no_duplicates.boxplot(column='time_spend_company', return_type='both') outliers = [flier.get_ydata()[0] for flier in flier_dict['fliers']] outlier_rows = hr_no_duplicates['time_spend_company'].isin(outliers) num_outliers = outlier_rows.sum() print('Number of rows containing outliers:', num_outliers)
code
130007434/cell_10
[ "text_html_output_1.png" ]
import pandas as pd dataset_path = '/kaggle/input/hr-analytics-and-job-prediction/HR_comma_sep.csv' hr = pd.read_csv(dataset_path) hr.columns hr.columns = hr.columns.str.lower() hr.columns = hr.columns.str.replace(' ', '_') hr.columns = hr.columns.str.replace('\\W', '_', regex=True) hr.columns hr.isna().sum() duplicates_mask = hr.duplicated() duplicates = hr[duplicates_mask] duplicates.shape
code
130007434/cell_12
[ "text_html_output_1.png" ]
import pandas as pd dataset_path = '/kaggle/input/hr-analytics-and-job-prediction/HR_comma_sep.csv' hr = pd.read_csv(dataset_path) hr.columns hr.columns = hr.columns.str.lower() hr.columns = hr.columns.str.replace(' ', '_') hr.columns = hr.columns.str.replace('\\W', '_', regex=True) hr.columns hr.isna().sum() duplicates_mask = hr.duplicated() duplicates = hr[duplicates_mask] duplicates.shape hr.duplicated().sum() hr_no_duplicates = hr.drop_duplicates() hr_no_duplicates
code
130007434/cell_5
[ "image_output_1.png" ]
import pandas as pd dataset_path = '/kaggle/input/hr-analytics-and-job-prediction/HR_comma_sep.csv' hr = pd.read_csv(dataset_path) hr.info()
code
130012889/cell_6
[ "text_html_output_1.png" ]
from sklearn.ensemble import RandomForestClassifier model = RandomForestClassifier(n_estimators=100, random_state=42) model.fit(X_train, y_train)
code
130012889/cell_1
[ "application_vnd.jupyter.stderr_output_1.png" ]
import pandas as pd from sklearn.model_selection import train_test_split from sklearn.preprocessing import LabelEncoder from sklearn.impute import SimpleImputer from sklearn.ensemble import RandomForestClassifier from sklearn.metrics import accuracy_score
code
130012889/cell_7
[ "text_plain_output_1.png" ]
from sklearn.ensemble import RandomForestClassifier from sklearn.metrics import accuracy_score model = RandomForestClassifier(n_estimators=100, random_state=42) model.fit(X_train, y_train) preds_valid = model.predict(X_valid) print(accuracy_score(y_valid, preds_valid))
code
18148304/cell_4
[ "text_plain_output_1.png" ]
import pandas as pd import statsmodels.api as sm # https://www.statsmodels.org/stable/index.html import pandas as pd import matplotlib.pyplot as plt import statsmodels.api as sm input_data = pd.read_csv('../input/US_graduate_schools_admission_parameters_dataset_private.csv') X = input_data[['GRE Score', 'IELTS Score', 'SOP', 'LOR ', 'CGPA']] y = input_data['Chance of Admit '] X = sm.add_constant(X) multiple_linear_regression_model = sm.OLS(y, X) multiple_linear_regression_model_fit = multiple_linear_regression_model.fit() print(multiple_linear_regression_model_fit.params)
code
18148304/cell_6
[ "image_output_1.png" ]
import matplotlib.pyplot as plt # documentation: https://matplotlib.org/api/pyplot_api.html import pandas as pd import statsmodels.api as sm # https://www.statsmodels.org/stable/index.html import pandas as pd import matplotlib.pyplot as plt import statsmodels.api as sm input_data = pd.read_csv('../input/US_graduate_schools_admission_parameters_dataset_private.csv') X = input_data[['GRE Score', 'IELTS Score', 'SOP', 'LOR ', 'CGPA']] y = input_data['Chance of Admit '] X = sm.add_constant(X) multiple_linear_regression_model = sm.OLS(y, X) multiple_linear_regression_model_fit = multiple_linear_regression_model.fit() X1 = input_data['GRE Score'] y = input_data['Chance of Admit '] plt.scatter(X1, y) plt.show()
code
18148304/cell_8
[ "text_html_output_1.png" ]
import pandas as pd import statsmodels.api as sm # https://www.statsmodels.org/stable/index.html import pandas as pd import matplotlib.pyplot as plt import statsmodels.api as sm input_data = pd.read_csv('../input/US_graduate_schools_admission_parameters_dataset_private.csv') X = input_data[['GRE Score', 'IELTS Score', 'SOP', 'LOR ', 'CGPA']] y = input_data['Chance of Admit '] X = sm.add_constant(X) multiple_linear_regression_model = sm.OLS(y, X) multiple_linear_regression_model_fit = multiple_linear_regression_model.fit() multiple_linear_regression_model_fit.summary()
code
18148304/cell_3
[ "text_html_output_1.png" ]
import pandas as pd import pandas as pd import matplotlib.pyplot as plt import statsmodels.api as sm input_data = pd.read_csv('../input/US_graduate_schools_admission_parameters_dataset_private.csv') input_data.head()
code
33109004/cell_25
[ "image_output_1.png" ]
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import seaborn as sns car_us_df = pd.read_csv('/kaggle/input/usa-cers-dataset/USA_cars_datasets.csv', index_col=0) special_cases_price_zero = car_us_df[car_us_df.price == 0] special_cases_price_zero.shape special_cases_price_great = car_us_df[car_us_df.price >= 30000] special_cases_price_great.head()
code
33109004/cell_56
[ "text_html_output_1.png" ]
from sklearn.model_selection import train_test_split,cross_val_score,KFold,cross_val_predict,GridSearchCV from xgboost import XGBRegressor import matplotlib.pyplot as plt import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import seaborn as sns def plot_bar_vertical(df, figsize=(10, 15), xlabel='Count Number'): ax = df.plot.barh(figsize=figsize) for p in ax.patches: ax.text(p.get_x() + p.get_width(), p.get_y() + p.get_height() / 2, f'{int(p.get_width())}') car_us_df = pd.read_csv('/kaggle/input/usa-cers-dataset/USA_cars_datasets.csv', index_col=0) special_cases_price_zero = car_us_df[car_us_df.price == 0] special_cases_price_zero.shape special_cases_price_great = car_us_df[car_us_df.price >= 30000] car_us_df[car_us_df.price == car_us_df.price.max()] price_estimator_df = car_us_df.copy() features_to_drop = ['vin', 'lot', 'country', 'condition'] price_estimator_df.drop(features_to_drop, axis=1, inplace=True) price_estimator_df cat_features = [col for col in price_estimator_df.select_dtypes('object')] cat_features price_estimator_df.isnull().any() train = price_estimator_df.drop('price', axis=1) target = price_estimator_df.price params = {'n_estimator': [1, 1000, 50], 'n_jobs': [1, 5, 1]} model = XGBRegressor() result = abs(cross_val_score(model, train, target, cv=KFold(n_splits=10), scoring='r2')).mean() result
code
33109004/cell_33
[ "text_html_output_1.png" ]
import matplotlib.pyplot as plt import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import seaborn as sns def plot_bar_vertical(df, figsize=(10, 15), xlabel='Count Number'): ax = df.plot.barh(figsize=figsize) for p in ax.patches: ax.text(p.get_x() + p.get_width(), p.get_y() + p.get_height() / 2, f'{int(p.get_width())}') car_us_df = pd.read_csv('/kaggle/input/usa-cers-dataset/USA_cars_datasets.csv', index_col=0) special_cases_price_zero = car_us_df[car_us_df.price == 0] special_cases_price_zero.shape special_cases_price_great = car_us_df[car_us_df.price >= 30000] car_us_df[car_us_df.price == car_us_df.price.max()] plot_bar_vertical(car_us_df.groupby(['brand', 'model']).brand.count().sort_values().tail(15))
code
33109004/cell_44
[ "image_output_1.png" ]
import matplotlib.pyplot as plt import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import seaborn as sns def plot_bar_vertical(df, figsize=(10, 15), xlabel='Count Number'): ax = df.plot.barh(figsize=figsize) for p in ax.patches: ax.text(p.get_x() + p.get_width(), p.get_y() + p.get_height() / 2, f'{int(p.get_width())}') car_us_df = pd.read_csv('/kaggle/input/usa-cers-dataset/USA_cars_datasets.csv', index_col=0) special_cases_price_zero = car_us_df[car_us_df.price == 0] special_cases_price_zero.shape special_cases_price_great = car_us_df[car_us_df.price >= 30000] car_us_df[car_us_df.price == car_us_df.price.max()] price_estimator_df = car_us_df.copy() features_to_drop = ['vin', 'lot', 'country', 'condition'] price_estimator_df.drop(features_to_drop, axis=1, inplace=True) price_estimator_df
code
33109004/cell_55
[ "text_html_output_1.png" ]
import matplotlib.pyplot as plt import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import seaborn as sns def plot_bar_vertical(df, figsize=(10, 15), xlabel='Count Number'): ax = df.plot.barh(figsize=figsize) for p in ax.patches: ax.text(p.get_x() + p.get_width(), p.get_y() + p.get_height() / 2, f'{int(p.get_width())}') car_us_df = pd.read_csv('/kaggle/input/usa-cers-dataset/USA_cars_datasets.csv', index_col=0) special_cases_price_zero = car_us_df[car_us_df.price == 0] special_cases_price_zero.shape special_cases_price_great = car_us_df[car_us_df.price >= 30000] car_us_df[car_us_df.price == car_us_df.price.max()] price_estimator_df = car_us_df.copy() features_to_drop = ['vin', 'lot', 'country', 'condition'] price_estimator_df.drop(features_to_drop, axis=1, inplace=True) price_estimator_df cat_features = [col for col in price_estimator_df.select_dtypes('object')] cat_features price_estimator_df.isnull().any() train = price_estimator_df.drop('price', axis=1) target = price_estimator_df.price X_trin, X_val, y_train, y_val = train
code
33109004/cell_6
[ "application_vnd.jupyter.stderr_output_1.png" ]
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) car_us_df = pd.read_csv('/kaggle/input/usa-cers-dataset/USA_cars_datasets.csv', index_col=0) car_us_df.info()
code
33109004/cell_40
[ "text_html_output_1.png" ]
import matplotlib.pyplot as plt import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import seaborn as sns def plot_bar_vertical(df, figsize=(10, 15), xlabel='Count Number'): ax = df.plot.barh(figsize=figsize) for p in ax.patches: ax.text(p.get_x() + p.get_width(), p.get_y() + p.get_height() / 2, f'{int(p.get_width())}') car_us_df = pd.read_csv('/kaggle/input/usa-cers-dataset/USA_cars_datasets.csv', index_col=0) special_cases_price_zero = car_us_df[car_us_df.price == 0] special_cases_price_zero.shape special_cases_price_great = car_us_df[car_us_df.price >= 30000] car_us_df[car_us_df.price == car_us_df.price.max()] plot_bar_vertical(car_us_df.state.value_counts().sort_values())
code
33109004/cell_29
[ "text_html_output_1.png" ]
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import seaborn as sns car_us_df = pd.read_csv('/kaggle/input/usa-cers-dataset/USA_cars_datasets.csv', index_col=0) special_cases_price_zero = car_us_df[car_us_df.price == 0] special_cases_price_zero.shape special_cases_price_great = car_us_df[car_us_df.price >= 30000] car_us_df[car_us_df.price == car_us_df.price.max()]
code
33109004/cell_26
[ "image_output_1.png" ]
import matplotlib.pyplot as plt import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import seaborn as sns def plot_bar_vertical(df, figsize=(10, 15), xlabel='Count Number'): ax = df.plot.barh(figsize=figsize) for p in ax.patches: ax.text(p.get_x() + p.get_width(), p.get_y() + p.get_height() / 2, f'{int(p.get_width())}') car_us_df = pd.read_csv('/kaggle/input/usa-cers-dataset/USA_cars_datasets.csv', index_col=0) special_cases_price_zero = car_us_df[car_us_df.price == 0] special_cases_price_zero.shape special_cases_price_great = car_us_df[car_us_df.price >= 30000] plot_bar_vertical(special_cases_price_great.groupby(['brand', 'model']).brand.count().sort_values())
code
33109004/cell_48
[ "image_output_1.png" ]
import matplotlib.pyplot as plt import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import seaborn as sns def plot_bar_vertical(df, figsize=(10, 15), xlabel='Count Number'): ax = df.plot.barh(figsize=figsize) for p in ax.patches: ax.text(p.get_x() + p.get_width(), p.get_y() + p.get_height() / 2, f'{int(p.get_width())}') car_us_df = pd.read_csv('/kaggle/input/usa-cers-dataset/USA_cars_datasets.csv', index_col=0) special_cases_price_zero = car_us_df[car_us_df.price == 0] special_cases_price_zero.shape special_cases_price_great = car_us_df[car_us_df.price >= 30000] car_us_df[car_us_df.price == car_us_df.price.max()] price_estimator_df = car_us_df.copy() features_to_drop = ['vin', 'lot', 'country', 'condition'] price_estimator_df.drop(features_to_drop, axis=1, inplace=True) price_estimator_df cat_features = [col for col in price_estimator_df.select_dtypes('object')] cat_features price_estimator_df.isnull().any()
code
33109004/cell_2
[ "text_plain_output_1.png" ]
import os import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import os for dirname, _, filenames in os.walk('/kaggle/input'): for filename in filenames: print(os.path.join(dirname, filename))
code
33109004/cell_54
[ "text_plain_output_1.png" ]
from sklearn.preprocessing import LabelEncoder,OneHotEncoder import matplotlib.pyplot as plt import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import seaborn as sns def plot_bar_vertical(df, figsize=(10, 15), xlabel='Count Number'): ax = df.plot.barh(figsize=figsize) for p in ax.patches: ax.text(p.get_x() + p.get_width(), p.get_y() + p.get_height() / 2, f'{int(p.get_width())}') car_us_df = pd.read_csv('/kaggle/input/usa-cers-dataset/USA_cars_datasets.csv', index_col=0) special_cases_price_zero = car_us_df[car_us_df.price == 0] special_cases_price_zero.shape special_cases_price_great = car_us_df[car_us_df.price >= 30000] car_us_df[car_us_df.price == car_us_df.price.max()] price_estimator_df = car_us_df.copy() features_to_drop = ['vin', 'lot', 'country', 'condition'] price_estimator_df.drop(features_to_drop, axis=1, inplace=True) price_estimator_df cat_features = [col for col in price_estimator_df.select_dtypes('object')] cat_features price_estimator_df.isnull().any() train = price_estimator_df.drop('price', axis=1) target = price_estimator_df.price cat_transformer = LabelEncoder() for col in cat_features: train[col] = cat_transformer.fit_transform(train[col]) train
code
33109004/cell_11
[ "text_plain_output_1.png" ]
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import seaborn as sns car_us_df = pd.read_csv('/kaggle/input/usa-cers-dataset/USA_cars_datasets.csv', index_col=0) sns.distplot(car_us_df.price, kde=False)
code
33109004/cell_19
[ "text_plain_output_1.png", "image_output_1.png" ]
import matplotlib.pyplot as plt import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import seaborn as sns def plot_bar_vertical(df, figsize=(10, 15), xlabel='Count Number'): ax = df.plot.barh(figsize=figsize) for p in ax.patches: ax.text(p.get_x() + p.get_width(), p.get_y() + p.get_height() / 2, f'{int(p.get_width())}') car_us_df = pd.read_csv('/kaggle/input/usa-cers-dataset/USA_cars_datasets.csv', index_col=0) special_cases_price_zero = car_us_df[car_us_df.price == 0] special_cases_price_zero.shape ax = special_cases_price_zero.groupby(['brand', 'model']).brand.count().plot.pie(figsize=(10, 15), subplots=True)
code
33109004/cell_7
[ "text_plain_output_1.png" ]
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) car_us_df = pd.read_csv('/kaggle/input/usa-cers-dataset/USA_cars_datasets.csv', index_col=0) car_us_df.describe()
code
33109004/cell_18
[ "text_html_output_1.png" ]
import matplotlib.pyplot as plt import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import seaborn as sns def plot_bar_vertical(df, figsize=(10, 15), xlabel='Count Number'): ax = df.plot.barh(figsize=figsize) for p in ax.patches: ax.text(p.get_x() + p.get_width(), p.get_y() + p.get_height() / 2, f'{int(p.get_width())}') car_us_df = pd.read_csv('/kaggle/input/usa-cers-dataset/USA_cars_datasets.csv', index_col=0) special_cases_price_zero = car_us_df[car_us_df.price == 0] special_cases_price_zero.shape plot_bar_vertical(special_cases_price_zero.groupby(['brand', 'model']).brand.count().sort_values())
code
33109004/cell_51
[ "text_plain_output_1.png" ]
import matplotlib.pyplot as plt import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import seaborn as sns def plot_bar_vertical(df, figsize=(10, 15), xlabel='Count Number'): ax = df.plot.barh(figsize=figsize) for p in ax.patches: ax.text(p.get_x() + p.get_width(), p.get_y() + p.get_height() / 2, f'{int(p.get_width())}') car_us_df = pd.read_csv('/kaggle/input/usa-cers-dataset/USA_cars_datasets.csv', index_col=0) special_cases_price_zero = car_us_df[car_us_df.price == 0] special_cases_price_zero.shape special_cases_price_great = car_us_df[car_us_df.price >= 30000] car_us_df[car_us_df.price == car_us_df.price.max()] price_estimator_df = car_us_df.copy() features_to_drop = ['vin', 'lot', 'country', 'condition'] price_estimator_df.drop(features_to_drop, axis=1, inplace=True) price_estimator_df cat_features = [col for col in price_estimator_df.select_dtypes('object')] cat_features price_estimator_df.isnull().any() train = price_estimator_df.drop('price', axis=1) target = price_estimator_df.price train
code
33109004/cell_15
[ "text_plain_output_1.png" ]
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import seaborn as sns car_us_df = pd.read_csv('/kaggle/input/usa-cers-dataset/USA_cars_datasets.csv', index_col=0) special_cases_price_zero = car_us_df[car_us_df.price == 0] display(special_cases_price_zero.head(10)) special_cases_price_zero.shape
code
33109004/cell_46
[ "image_output_1.png" ]
import matplotlib.pyplot as plt import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import seaborn as sns def plot_bar_vertical(df, figsize=(10, 15), xlabel='Count Number'): ax = df.plot.barh(figsize=figsize) for p in ax.patches: ax.text(p.get_x() + p.get_width(), p.get_y() + p.get_height() / 2, f'{int(p.get_width())}') car_us_df = pd.read_csv('/kaggle/input/usa-cers-dataset/USA_cars_datasets.csv', index_col=0) special_cases_price_zero = car_us_df[car_us_df.price == 0] special_cases_price_zero.shape special_cases_price_great = car_us_df[car_us_df.price >= 30000] car_us_df[car_us_df.price == car_us_df.price.max()] price_estimator_df = car_us_df.copy() features_to_drop = ['vin', 'lot', 'country', 'condition'] price_estimator_df.drop(features_to_drop, axis=1, inplace=True) price_estimator_df cat_features = [col for col in price_estimator_df.select_dtypes('object')] cat_features
code
33109004/cell_22
[ "text_html_output_1.png", "text_plain_output_1.png" ]
import matplotlib.pyplot as plt import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import seaborn as sns def plot_bar_vertical(df, figsize=(10, 15), xlabel='Count Number'): ax = df.plot.barh(figsize=figsize) for p in ax.patches: ax.text(p.get_x() + p.get_width(), p.get_y() + p.get_height() / 2, f'{int(p.get_width())}') car_us_df = pd.read_csv('/kaggle/input/usa-cers-dataset/USA_cars_datasets.csv', index_col=0) special_cases_price_zero = car_us_df[car_us_df.price == 0] special_cases_price_zero.shape ax = special_cases_price_zero.groupby(['brand','model']).brand.count().plot.pie(figsize=(10,15),subplots=True) special_cases_price_zero[special_cases_price_zero.title_status == 'clean vehicle']
code
33109004/cell_12
[ "text_html_output_1.png" ]
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import seaborn as sns car_us_df = pd.read_csv('/kaggle/input/usa-cers-dataset/USA_cars_datasets.csv', index_col=0) car_us_df.price.describe()
code
33109004/cell_5
[ "text_html_output_1.png" ]
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) car_us_df = pd.read_csv('/kaggle/input/usa-cers-dataset/USA_cars_datasets.csv', index_col=0) car_us_df.head()
code
33109004/cell_36
[ "image_output_1.png" ]
import matplotlib.pyplot as plt import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import seaborn as sns def plot_bar_vertical(df, figsize=(10, 15), xlabel='Count Number'): ax = df.plot.barh(figsize=figsize) for p in ax.patches: ax.text(p.get_x() + p.get_width(), p.get_y() + p.get_height() / 2, f'{int(p.get_width())}') car_us_df = pd.read_csv('/kaggle/input/usa-cers-dataset/USA_cars_datasets.csv', index_col=0) special_cases_price_zero = car_us_df[car_us_df.price == 0] special_cases_price_zero.shape special_cases_price_great = car_us_df[car_us_df.price >= 30000] car_us_df[car_us_df.price == car_us_df.price.max()] plot_bar_vertical(car_us_df.groupby(['brand', 'model']).price.mean().sort_values(), (12, 50), 'price')
code
104124059/cell_9
[ "text_plain_output_1.png" ]
(1.0 - 4.85883614 / 97) * 100
code
104124059/cell_7
[ "text_plain_output_1.png" ]
import scipy.sparse as sps train_input = sps.load_npz('../input/open-problems-msci-multiome-sparse-matrices/train_multiome_input_sparse.npz') def get_size(sparse_m): size_gb = (sparse_m.indices.nbytes + sparse_m.indptr.nbytes + sparse_m.data.nbytes) * 1e-09 return f'Size: {size_gb} GB' get_size(train_input)
code
32069364/cell_21
[ "text_html_output_1.png" ]
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) df = pd.read_csv('/kaggle/input/hmeq-data/hmeq.csv') df.isnull().sum() df2 = df df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO'], how='all') df2
code
32069364/cell_13
[ "text_plain_output_1.png" ]
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) df = pd.read_csv('/kaggle/input/hmeq-data/hmeq.csv') df.isnull().sum() df['MORTDUE'].value_counts()
code
32069364/cell_9
[ "text_plain_output_1.png" ]
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) df = pd.read_csv('/kaggle/input/hmeq-data/hmeq.csv') df.isnull().sum()
code
32069364/cell_4
[ "text_plain_output_1.png" ]
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) df = pd.read_csv('/kaggle/input/hmeq-data/hmeq.csv') df['REASON'].value_counts()
code
32069364/cell_34
[ "text_plain_output_1.png" ]
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) df = pd.read_csv('/kaggle/input/hmeq-data/hmeq.csv') df.isnull().sum() df2 = df df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO'], how='all') mode = float(df2['VALUEMORTDUE'].mode()) mode MORTDUEMEDIA = {'MORTDUE': df2['VALUE'] / mode} df2 = df2.fillna(value=MORTDUEMEDIA) VALUEMEDIA = {'VALUE': df2['MORTDUE'] * mode} df2 = df2.fillna(value=VALUEMEDIA) df2.isnull().sum() df2.isnull().sum() df2.isnull().sum()
code
32069364/cell_23
[ "text_plain_output_1.png" ]
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) df = pd.read_csv('/kaggle/input/hmeq-data/hmeq.csv') df.isnull().sum() df2 = df df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO'], how='all') df2.head(30)
code
32069364/cell_30
[ "text_plain_output_1.png" ]
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) df = pd.read_csv('/kaggle/input/hmeq-data/hmeq.csv') df.isnull().sum() df2 = df df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO'], how='all') mode = float(df2['VALUEMORTDUE'].mode()) mode MORTDUEMEDIA = {'MORTDUE': df2['VALUE'] / mode} df2 = df2.fillna(value=MORTDUEMEDIA) VALUEMEDIA = {'VALUE': df2['MORTDUE'] * mode} df2 = df2.fillna(value=VALUEMEDIA) df2.isnull().sum() df2.info()
code
32069364/cell_33
[ "text_plain_output_1.png" ]
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import plotly.express as px df = pd.read_csv('/kaggle/input/hmeq-data/hmeq.csv') df.isnull().sum() df2 = df df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO'], how='all') mode = float(df2['VALUEMORTDUE'].mode()) mode MORTDUEMEDIA = {'MORTDUE': df2['VALUE'] / mode} df2 = df2.fillna(value=MORTDUEMEDIA) VALUEMEDIA = {'VALUE': df2['MORTDUE'] * mode} df2 = df2.fillna(value=VALUEMEDIA) df2.isnull().sum() df2.isnull().sum() import plotly.express as px fig = px.bar(df2, x='REASON', y='JOB', color='JOB') fig.show()
code
32069364/cell_29
[ "text_html_output_1.png" ]
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) df = pd.read_csv('/kaggle/input/hmeq-data/hmeq.csv') df.isnull().sum() df['MORTDUE'].min()
code
32069364/cell_26
[ "text_plain_output_2.png", "application_vnd.jupyter.stderr_output_1.png", "image_output_1.png" ]
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) df = pd.read_csv('/kaggle/input/hmeq-data/hmeq.csv') df.isnull().sum() df2 = df df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO'], how='all') mode = float(df2['VALUEMORTDUE'].mode()) mode MORTDUEMEDIA = {'MORTDUE': df2['VALUE'] / mode} df2 = df2.fillna(value=MORTDUEMEDIA) VALUEMEDIA = {'VALUE': df2['MORTDUE'] * mode} df2 = df2.fillna(value=VALUEMEDIA) df2.info()
code
32069364/cell_11
[ "text_plain_output_1.png" ]
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) df = pd.read_csv('/kaggle/input/hmeq-data/hmeq.csv') df.isnull().sum() df.describe()
code
32069364/cell_19
[ "text_html_output_1.png" ]
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) df = pd.read_csv('/kaggle/input/hmeq-data/hmeq.csv') df.isnull().sum() df2 = df df2
code
32069364/cell_1
[ "text_plain_output_1.png" ]
import os import numpy as np import pandas as pd import os for dirname, _, filenames in os.walk('/kaggle/input'): for filename in filenames: print(os.path.join(dirname, filename))
code
32069364/cell_32
[ "text_plain_output_1.png" ]
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import plotly.io as pio df = pd.read_csv('/kaggle/input/hmeq-data/hmeq.csv') df.isnull().sum() df2 = df df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO'], how='all') mode = float(df2['VALUEMORTDUE'].mode()) mode MORTDUEMEDIA = {'MORTDUE': df2['VALUE'] / mode} df2 = df2.fillna(value=MORTDUEMEDIA) VALUEMEDIA = {'VALUE': df2['MORTDUE'] * mode} df2 = df2.fillna(value=VALUEMEDIA) df2.isnull().sum() df2.isnull().sum() import plotly.io as pio GRAREASON = [dict(type='bar', x=df2['JOB'], y=df2['REASON'].value_counts(dropna=False), mode='markers')] layout = dict(title='REASON = 1') fig_dict = dict(data=GRAREASON, layout=layout) pio.show(fig_dict, validate=False)
code
32069364/cell_8
[ "text_plain_output_1.png", "image_output_1.png" ]
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) df = pd.read_csv('/kaggle/input/hmeq-data/hmeq.csv') df.select_dtypes('object').head()
code
32069364/cell_15
[ "text_html_output_1.png" ]
import matplotlib.pyplot as plt import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import seaborn as sns df = pd.read_csv('/kaggle/input/hmeq-data/hmeq.csv') df.isnull().sum() plt.figure(figsize=(4, 4)) sns.countplot(y='REASON', data=df) plt.figure(figsize=(8, 8)) sns.countplot(y='JOB', data=df) plt.figure(figsize=(8, 8)) sns.countplot(y='DEROG', data=df) plt.figure(figsize=(8, 8)) sns.countplot(y='DELINQ', data=df) plt.figure(figsize=(8, 8)) sns.countplot(y='NINQ', data=df)
code
32069364/cell_16
[ "text_plain_output_1.png" ]
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) df = pd.read_csv('/kaggle/input/hmeq-data/hmeq.csv') df.isnull().sum() df[['LOAN', 'MORTDUE', 'VALUE', 'YOJ', 'CLAGE', 'CLNO', 'DEBTINC']].hist(figsize=[20, 20])
code
32069364/cell_3
[ "text_html_output_1.png" ]
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) df = pd.read_csv('/kaggle/input/hmeq-data/hmeq.csv') df.info()
code
32069364/cell_31
[ "text_plain_output_1.png" ]
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) df = pd.read_csv('/kaggle/input/hmeq-data/hmeq.csv') df.isnull().sum() df2 = df df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO'], how='all') mode = float(df2['VALUEMORTDUE'].mode()) mode MORTDUEMEDIA = {'MORTDUE': df2['VALUE'] / mode} df2 = df2.fillna(value=MORTDUEMEDIA) VALUEMEDIA = {'VALUE': df2['MORTDUE'] * mode} df2 = df2.fillna(value=VALUEMEDIA) df2.isnull().sum() df2.isnull().sum()
code
32069364/cell_24
[ "image_output_5.png", "image_output_4.png", "text_plain_output_1.png", "image_output_3.png", "image_output_2.png", "image_output_1.png" ]
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) df = pd.read_csv('/kaggle/input/hmeq-data/hmeq.csv') df.isnull().sum() df2 = df df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO'], how='all') mode = float(df2['VALUEMORTDUE'].mode()) mode
code
32069364/cell_27
[ "text_html_output_1.png" ]
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) df = pd.read_csv('/kaggle/input/hmeq-data/hmeq.csv') df.isnull().sum() df2 = df df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO'], how='all') mode = float(df2['VALUEMORTDUE'].mode()) mode MORTDUEMEDIA = {'MORTDUE': df2['VALUE'] / mode} df2 = df2.fillna(value=MORTDUEMEDIA) VALUEMEDIA = {'VALUE': df2['MORTDUE'] * mode} df2 = df2.fillna(value=VALUEMEDIA) df2.isnull().sum()
code
32069364/cell_37
[ "text_html_output_2.png" ]
import matplotlib.pyplot as plt import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import seaborn as sns df = pd.read_csv('/kaggle/input/hmeq-data/hmeq.csv') df.isnull().sum() df2 = df df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO'], how='all') mode = float(df2['VALUEMORTDUE'].mode()) mode MORTDUEMEDIA = {'MORTDUE': df2['VALUE'] / mode} df2 = df2.fillna(value=MORTDUEMEDIA) VALUEMEDIA = {'VALUE': df2['MORTDUE'] * mode} df2 = df2.fillna(value=VALUEMEDIA) df2.isnull().sum() df2.isnull().sum() df2.isnull().sum() df2.isnull().sum() corr = df2.corr(method='spearman') mask = np.zeros_like(corr, dtype=np.bool) mask[np.triu_indices_from(mask)] = True f, ax = plt.subplots(figsize=(20, 18)) sns.heatmap(corr, mask=mask, cmap='YlGnBu', vmax=0.3, center=0, square=True, linewidths=0.5, cbar_kws={'shrink': 0.5})
code
32069364/cell_12
[ "text_plain_output_1.png" ]
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) df = pd.read_csv('/kaggle/input/hmeq-data/hmeq.csv') df.isnull().sum() df['BAD'].value_counts().reset_index()
code
32069364/cell_5
[ "text_plain_output_1.png" ]
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) df = pd.read_csv('/kaggle/input/hmeq-data/hmeq.csv') df['JOB'].value_counts()
code
32069364/cell_36
[ "text_plain_output_1.png" ]
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) df = pd.read_csv('/kaggle/input/hmeq-data/hmeq.csv') df.isnull().sum() df2 = df df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'CLAGE', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'NINQ', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'CLNO', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'DEBTINC'], how='all') df2 = df2.dropna(subset=['MORTDUE', 'VALUE', 'REASON', 'JOB', 'YOJ', 'DEROG', 'DELINQ', 'CLAGE', 'NINQ', 'CLNO'], how='all') mode = float(df2['VALUEMORTDUE'].mode()) mode MORTDUEMEDIA = {'MORTDUE': df2['VALUE'] / mode} df2 = df2.fillna(value=MORTDUEMEDIA) VALUEMEDIA = {'VALUE': df2['MORTDUE'] * mode} df2 = df2.fillna(value=VALUEMEDIA) df2.isnull().sum() df2.isnull().sum() df2.isnull().sum() df2.isnull().sum()
code
32065554/cell_26
[ "application_vnd.jupyter.stderr_output_1.png" ]
def function(stuff): """ Describe your function """ y = 0 return y x = function(stuff) x
code
32065554/cell_15
[ "text_plain_output_1.png" ]
import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) def get_number_of_elements_nested_list(list_of_keyword_lists): counter = 0 for lst in list_of_keyword_lists: counter += len(lst) return counter def evaluate_text_via_list_of_list_of_keywords(text, list_of_keyword_lists): num_keyword_lists = len(list_of_keyword_lists) len_text = len(text) arr_keyword_list_hits = np.zeros(num_keyword_lists) for num_word in range(len_text): for num_keyword_list in range(num_keyword_lists): if text[num_word] in list_of_keyword_lists[num_keyword_list]: arr_keyword_list_hits[num_keyword_list] += 1 return arr_keyword_list_hits def evaluate_journal_by_keywords(df_paper, list_of_keyword_lists): """ df_paper pd.DataFrame with Covid 19 papers list_of_keyword_lists Nested list. Contains multiple lists with keywords. Each list is a subgroup/clustering of keywords. """ num_entries = df_paper.shape[0] dct_abstracts = {} num_keywords = get_number_of_elements_nested_list(list_of_keyword_lists) for num_paper in range(num_entries): if type(df_paper.iloc[num_paper, 8]) != float: txt_abstract = df_paper.iloc[num_paper, 8].split() idx = num_paper arr_keyword_list_hits = evaluate_text_via_list_of_list_of_keywords(txt_abstract, list_of_keyword_lists) int_keyword_frequency = sum(arr_keyword_list_hits) num_keyword_sources = len(arr_keyword_list_hits[arr_keyword_list_hits > 0]) num_keyword_lists = len(list_of_keyword_lists) numerator = num_keyword_sources + int_keyword_frequency denominator = num_keyword_lists + num_keywords abstract_score = numerator / denominator dct_abstracts.update({num_paper: {'Abstract Score': abstract_score}}) return dct_abstracts data_dir = '../input/CORD-19-research-challenge/' data_file = 'metadata.csv' data = pd.read_csv(data_dir + data_file) lst_corona = ['Corona', 'corona', 'corona virus', 'coronavirus', 'corona viruses', 'coronaviruses', 'Coronaviridae', 'coronaviridae', 'COVID-19', 'Covid-19', 'covid-19', 'COVID', 'COV', 'SARS'] lst_genetics = ['genetics'] lst_origin = ['origin', 'member', 'family'] lst_evolution = ['evolution', 'development', 'develops', 'developed'] lst_task = [lst_genetics, lst_origin, lst_evolution] lst_subtask_1_genome = ['Genome', 'genome'] lst_subtask_1_dissemination = ['dissemination', 'Dissemination', 'propagation', 'Propagation', 'spread', 'Spread', 'spreading', 'Spreading'] lst_subtask_1_treatment = ['treatment', 'Treatment', 'diagnostic', 'Diagnostic', 'diagnostics', 'Diagnostics', 'therapeutics', 'Therapeutics'] lst_subtask_1_variation = ['Difference', 'in contrast', 'variation', 'deviation', 'shows mutations', 'enrichment', 'similarities'] lst_subtask_1_reference = ['Accession number', 'reference', 'sample', 'identification of'] lst_subtask_1_known = ['Known', 'already published', 'already reported'] lst_subtask_1 = [lst_subtask_1_genome, lst_subtask_1_dissemination, lst_subtask_1_treatment, lst_subtask_1_variation, lst_subtask_1_reference, lst_subtask_1_known, lst_corona] lst_subtask_2_ = [] lst_subtask_2_ = [] lst_subtask_2_ = [] lst_subtask_2_ = [] lst_subtask_2_ = [] lst_subtask_2 = [] lst_subtask_3_2_livestock = ['farm', 'wildlife', 'wild animal', 'undomesticated', 'livestock'] lst_subtask_3_2_area = ['Southeast-Asia'] lst_subtask_3_2_control = ['surveil', 'control', 'screen', 'check', 'monitor', 'examine'] lst_subtask_3_2 = [lst_subtask_3_2_livestock, lst_subtask_3_2_area, lst_subtask_3_2_control, lst_corona] lst_subtask_3_1_host = ['host', 'organism', 'human'] lst_subtask_3_2_infection = ['infection', 'disease', 'respiratory syndrom'] lst_subtask_3_3_lab = ['experimental', 'laboratory', 'under conditions'] lst_subtask_3 = [lst_subtask_3_1_host, lst_subtask_3_2_infection, lst_subtask_3_3_lab, lst_corona] lst_subtask_4_host = ['animal', 'host', 'hosts', 'Host', 'Hosts', 'human', 'Human', 'Humans', 'humans', 'CoV-Host', 'organism'] lst_subtask_4_transmission = ['pathogen', 'spill-over', 'intraspecies', 'interaction', 'host-shift', 'spread', 'evolution', 'transmission', 'infection'] lst_subtask_4_evidence = ['evidence', 'proof', 'association', 'connection', 'associated'] lst_subtask_4 = [lst_subtask_4_host, lst_subtask_4_transmission, lst_subtask_4_evidence, lst_corona] lst_subtask_5_ = [] lst_subtask_5_ = [] lst_subtask_5_ = [] lst_subtask_5_ = [] lst_subtask_5 = [] lst_subtask_6_ = [] lst_subtask_6_ = [] lst_subtask_6_ = [] lst_subtask_6_ = [] lst_subtask_6_ = [] lst_subtask_6 = [] dct_res = evaluate_journal_by_keywords(data, lst_subtask_1) lst_ranked = sorted(dct_res, key=lambda x: dct_res[x]['Abstract Score'], reverse=True) lst_ranked[:3]
code
32065554/cell_16
[ "text_plain_output_1.png" ]
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) data_dir = '../input/CORD-19-research-challenge/' data_file = 'metadata.csv' data = pd.read_csv(data_dir + data_file) data.iloc[23643, 8]
code
129029092/cell_21
[ "text_plain_output_1.png" ]
import matplotlib.pyplot as plt import pandas as pd import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import seaborn as sns df = pd.read_csv('/kaggle/input/spaceship-titanic/train.csv') data = pd.read_csv('/kaggle/input/spaceship-titanic/test.csv') df.shape data.shape df.drop('PassengerId', axis=1) df.drop('Name', axis=1, inplace=True) data.drop('PassengerId', axis=1) data.drop('Name', axis=1, inplace=True) df.isnull().sum() data.isnull().sum() new_df = pd.concat([df, data]) new_df.shape sns.pairplot(data=new_df, hue='Transported')
code
129029092/cell_9
[ "text_plain_output_1.png" ]
import pandas as pd import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import seaborn as sns df = pd.read_csv('/kaggle/input/spaceship-titanic/train.csv') df.shape sns.heatmap(df.isnull())
code
129029092/cell_30
[ "text_plain_output_1.png", "image_output_1.png" ]
from sklearn.model_selection import train_test_split from sklearn.tree import DecisionTreeClassifier import matplotlib.pyplot as plt import pandas as pd import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import seaborn as sns df = pd.read_csv('/kaggle/input/spaceship-titanic/train.csv') data = pd.read_csv('/kaggle/input/spaceship-titanic/test.csv') df.shape data.shape df.drop('PassengerId', axis=1) df.drop('Name', axis=1, inplace=True) data.drop('PassengerId', axis=1) data.drop('Name', axis=1, inplace=True) df.isnull().sum() data.isnull().sum() new_df = pd.concat([df, data]) new_df.shape df_test = new_df[new_df['Transported'].isnull()] df_train = new_df[~new_df['Transported'].isnull()] df.drop('Cabin', axis=1, inplace=True) data.drop('Cabin', axis=1, inplace=True) X = df_train.drop('Transported', axis=1) y = df_train['Transported'] from sklearn.model_selection import train_test_split X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=42, test_size=0.33, shuffle=True) from sklearn.tree import DecisionTreeClassifier y = df['Transported'] features = ['Destination', 'CryoSleep', 'HomePlanet', 'VIP'] X = pd.get_dummies(df[features]) X_test = pd.get_dummies(data[features]) model = DecisionTreeClassifier(max_depth=7) model.fit(X, y) data.columns y_pred = model.predict(X_test) output = pd.DataFrame({'PassengerId': data.PassengerId, 'Transported': y_pred}) output.to_csv('submission.csv', index=False) print('Submission successful!')
code
129029092/cell_20
[ "text_plain_output_1.png" ]
import matplotlib.pyplot as plt import pandas as pd import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import seaborn as sns df = pd.read_csv('/kaggle/input/spaceship-titanic/train.csv') data = pd.read_csv('/kaggle/input/spaceship-titanic/test.csv') df.shape data.shape df.drop('PassengerId', axis=1) df.drop('Name', axis=1, inplace=True) data.drop('PassengerId', axis=1) data.drop('Name', axis=1, inplace=True) df.isnull().sum() data.isnull().sum() new_df = pd.concat([df, data]) new_df.shape sns.histplot(data=new_df, x='Age', bins=20, color='pink')
code
129029092/cell_6
[ "text_html_output_1.png" ]
import pandas as pd import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) df = pd.read_csv('/kaggle/input/spaceship-titanic/train.csv') data = pd.read_csv('/kaggle/input/spaceship-titanic/test.csv') data.head()
code
129029092/cell_26
[ "text_plain_output_1.png" ]
from sklearn.model_selection import train_test_split from sklearn.tree import DecisionTreeClassifier import matplotlib.pyplot as plt import pandas as pd import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import seaborn as sns df = pd.read_csv('/kaggle/input/spaceship-titanic/train.csv') data = pd.read_csv('/kaggle/input/spaceship-titanic/test.csv') df.shape data.shape df.drop('PassengerId', axis=1) df.drop('Name', axis=1, inplace=True) data.drop('PassengerId', axis=1) data.drop('Name', axis=1, inplace=True) df.isnull().sum() data.isnull().sum() new_df = pd.concat([df, data]) new_df.shape df_test = new_df[new_df['Transported'].isnull()] df_train = new_df[~new_df['Transported'].isnull()] df.drop('Cabin', axis=1, inplace=True) data.drop('Cabin', axis=1, inplace=True) X = df_train.drop('Transported', axis=1) y = df_train['Transported'] from sklearn.model_selection import train_test_split X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=42, test_size=0.33, shuffle=True) from sklearn.tree import DecisionTreeClassifier y = df['Transported'] features = ['Destination', 'CryoSleep', 'HomePlanet', 'VIP'] X = pd.get_dummies(df[features]) X_test = pd.get_dummies(data[features]) model = DecisionTreeClassifier(max_depth=7) model.fit(X, y)
code
129029092/cell_2
[ "text_html_output_1.png" ]
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns
code
129029092/cell_11
[ "application_vnd.jupyter.stderr_output_1.png" ]
import pandas as pd import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import seaborn as sns df = pd.read_csv('/kaggle/input/spaceship-titanic/train.csv') data = pd.read_csv('/kaggle/input/spaceship-titanic/test.csv') df.shape data.shape df.drop('PassengerId', axis=1) df.drop('Name', axis=1, inplace=True) data.drop('PassengerId', axis=1) data.drop('Name', axis=1, inplace=True) df.head()
code
129029092/cell_19
[ "text_plain_output_1.png", "image_output_1.png" ]
import matplotlib.pyplot as plt import pandas as pd import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import seaborn as sns df = pd.read_csv('/kaggle/input/spaceship-titanic/train.csv') data = pd.read_csv('/kaggle/input/spaceship-titanic/test.csv') df.shape data.shape df.drop('PassengerId', axis=1) df.drop('Name', axis=1, inplace=True) data.drop('PassengerId', axis=1) data.drop('Name', axis=1, inplace=True) df.isnull().sum() data.isnull().sum() new_df = pd.concat([df, data]) new_df.shape plt.figure(figsize=(15, 10)) sns.heatmap(new_df.corr(), annot=True)
code
129029092/cell_1
[ "text_plain_output_1.png" ]
import os import numpy as np import pandas as pd import os for dirname, _, filenames in os.walk('/kaggle/input'): for filename in filenames: print(os.path.join(dirname, filename))
code
129029092/cell_7
[ "text_plain_output_1.png" ]
import pandas as pd import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) df = pd.read_csv('/kaggle/input/spaceship-titanic/train.csv') df.shape
code
129029092/cell_18
[ "text_plain_output_1.png" ]
import pandas as pd import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import seaborn as sns df = pd.read_csv('/kaggle/input/spaceship-titanic/train.csv') data = pd.read_csv('/kaggle/input/spaceship-titanic/test.csv') df.shape data.shape df.drop('PassengerId', axis=1) df.drop('Name', axis=1, inplace=True) data.drop('PassengerId', axis=1) data.drop('Name', axis=1, inplace=True) df.isnull().sum() data.isnull().sum() new_df = pd.concat([df, data]) new_df.shape
code
129029092/cell_28
[ "text_plain_output_1.png", "image_output_1.png" ]
from sklearn import tree from sklearn.model_selection import train_test_split from sklearn.tree import DecisionTreeClassifier import matplotlib.pyplot as plt import pandas as pd import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import seaborn as sns df = pd.read_csv('/kaggle/input/spaceship-titanic/train.csv') data = pd.read_csv('/kaggle/input/spaceship-titanic/test.csv') df.shape data.shape df.drop('PassengerId', axis=1) df.drop('Name', axis=1, inplace=True) data.drop('PassengerId', axis=1) data.drop('Name', axis=1, inplace=True) df.isnull().sum() data.isnull().sum() new_df = pd.concat([df, data]) new_df.shape columns = ['CryoSleep', 'Destination', 'VIP', 'HomePlanet'] for col in columns: fig, ax = plt.subplots(figsize=(5, 3)) sns.countplot(data=new_df, x=col, hue='Transported', ax=ax, color='pink') df_test = new_df[new_df['Transported'].isnull()] df_train = new_df[~new_df['Transported'].isnull()] df.drop('Cabin', axis=1, inplace=True) data.drop('Cabin', axis=1, inplace=True) X = df_train.drop('Transported', axis=1) y = df_train['Transported'] from sklearn.model_selection import train_test_split X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=42, test_size=0.33, shuffle=True) from sklearn.tree import DecisionTreeClassifier y = df['Transported'] features = ['Destination', 'CryoSleep', 'HomePlanet', 'VIP'] X = pd.get_dummies(df[features]) X_test = pd.get_dummies(data[features]) model = DecisionTreeClassifier(max_depth=7) model.fit(X, y) from sklearn import tree plt.figure(figsize=(50, 5)) tree.plot_tree(model, filled=True)
code
129029092/cell_8
[ "text_plain_output_1.png", "image_output_1.png" ]
import pandas as pd import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) df = pd.read_csv('/kaggle/input/spaceship-titanic/train.csv') data = pd.read_csv('/kaggle/input/spaceship-titanic/test.csv') data.shape
code
129029092/cell_15
[ "text_html_output_1.png" ]
import pandas as pd import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import seaborn as sns df = pd.read_csv('/kaggle/input/spaceship-titanic/train.csv') data = pd.read_csv('/kaggle/input/spaceship-titanic/test.csv') df.shape data.shape df.drop('PassengerId', axis=1) df.drop('Name', axis=1, inplace=True) data.drop('PassengerId', axis=1) data.drop('Name', axis=1, inplace=True) data.isnull().sum()
code
129029092/cell_17
[ "text_plain_output_1.png" ]
import pandas as pd import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import seaborn as sns df = pd.read_csv('/kaggle/input/spaceship-titanic/train.csv') data = pd.read_csv('/kaggle/input/spaceship-titanic/test.csv') df.shape data.shape df.drop('PassengerId', axis=1) df.drop('Name', axis=1, inplace=True) data.drop('PassengerId', axis=1) data.drop('Name', axis=1, inplace=True) df.isnull().sum() data.isnull().sum() new_df = pd.concat([df, data]) new_df.head()
code
129029092/cell_14
[ "text_html_output_1.png" ]
import pandas as pd import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import seaborn as sns df = pd.read_csv('/kaggle/input/spaceship-titanic/train.csv') data = pd.read_csv('/kaggle/input/spaceship-titanic/test.csv') df.shape data.shape df.drop('PassengerId', axis=1) df.drop('Name', axis=1, inplace=True) data.drop('PassengerId', axis=1) data.drop('Name', axis=1, inplace=True) df.isnull().sum()
code
129029092/cell_22
[ "text_html_output_1.png" ]
import matplotlib.pyplot as plt import pandas as pd import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import seaborn as sns df = pd.read_csv('/kaggle/input/spaceship-titanic/train.csv') data = pd.read_csv('/kaggle/input/spaceship-titanic/test.csv') df.shape data.shape df.drop('PassengerId', axis=1) df.drop('Name', axis=1, inplace=True) data.drop('PassengerId', axis=1) data.drop('Name', axis=1, inplace=True) df.isnull().sum() data.isnull().sum() new_df = pd.concat([df, data]) new_df.shape columns = ['CryoSleep', 'Destination', 'VIP', 'HomePlanet'] for col in columns: fig, ax = plt.subplots(figsize=(5, 3)) sns.countplot(data=new_df, x=col, hue='Transported', ax=ax, color='pink')
code
129029092/cell_27
[ "text_plain_output_2.png", "application_vnd.jupyter.stderr_output_1.png", "image_output_1.png" ]
import pandas as pd import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import seaborn as sns df = pd.read_csv('/kaggle/input/spaceship-titanic/train.csv') data = pd.read_csv('/kaggle/input/spaceship-titanic/test.csv') df.shape data.shape df.drop('PassengerId', axis=1) df.drop('Name', axis=1, inplace=True) data.drop('PassengerId', axis=1) data.drop('Name', axis=1, inplace=True) df.isnull().sum() data.isnull().sum() df.drop('Cabin', axis=1, inplace=True) data.drop('Cabin', axis=1, inplace=True) data.columns
code
129029092/cell_5
[ "image_output_4.png", "image_output_3.png", "image_output_2.png", "image_output_1.png" ]
import pandas as pd import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) df = pd.read_csv('/kaggle/input/spaceship-titanic/train.csv') df.head()
code
106210118/cell_9
[ "text_plain_output_1.png" ]
import pandas as pd import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) data = pd.read_csv('../input/marketing-strategy-personalised-offer/sample.csv') df1 = pd.read_csv('../input/marketing-strategy-personalised-offer/train_data.csv') feature_list = df1.columns[:-1].values label = [df1.columns[-1]] df1.describe()
code
106210118/cell_2
[ "text_html_output_1.png" ]
import os import os import numpy as np import pandas as pd import os import os for dirname, _, filenames in os.walk('/kaggle/input'): for filename in filenames: print(os.path.join(dirname, filename))
code
106210118/cell_11
[ "text_html_output_1.png" ]
import pandas as pd import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) data = pd.read_csv('../input/marketing-strategy-personalised-offer/sample.csv') df1 = pd.read_csv('../input/marketing-strategy-personalised-offer/train_data.csv') feature_list = df1.columns[:-1].values label = [df1.columns[-1]] df1.shape
code
106210118/cell_7
[ "text_html_output_1.png" ]
import pandas as pd import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) data = pd.read_csv('../input/marketing-strategy-personalised-offer/sample.csv') df1 = pd.read_csv('../input/marketing-strategy-personalised-offer/train_data.csv') df1.head(10)
code