Learn KAGGLE-KERNELS with Real Code Examples
Updated Nov 26, 2025
Code Sample Descriptions
1
Hello World in Kaggle Kernel (Python)
print("Hello World")
A simple Kaggle Kernel cell printing 'Hello World'.
2
Dataset Exploration in Kaggle Kernel
import pandas as pd
# Example: load dataset (assuming file is added to Kaggle Kernel input)
df = pd.read_csv("../input/sample-dataset/data.csv")
print(df.head())
Load a Kaggle dataset (CSV) into a Pandas DataFrame and display the first rows.
3
NumPy Array in Kaggle Kernel
import numpy as np
arr = np.array([[1,2,3],[4,5,6]])
print(arr.sum())
print(arr.T)
Create a NumPy array and perform basic operations.
4
Matplotlib Plot in Kaggle Kernel
import matplotlib.pyplot as plt
x = [1,2,3,4]
y = [10,20,25,30]
plt.plot(x, y)
plt.title('Line Graph')
plt.show()
Plot a simple line graph using matplotlib in a Kaggle Kernel.
5
Seaborn Plot in Kaggle Kernel
import seaborn as sns
import pandas as pd
import numpy as np
data = pd.DataFrame({'x': np.random.rand(50), 'y': np.random.rand(50)})
sns.scatterplot(x='x', y='y', data=data)
Create a Seaborn scatter plot in Kaggle Kernel.
6
Pandas GroupBy Example in Kaggle Kernel
import pandas as pd
df = pd.DataFrame({'Category': ['A','A','B','B'], 'Value': [10,20,30,40]})
print(df.groupby('Category').mean())
Group dataset by a column and calculate mean.
7
TensorFlow Basic Example in Kaggle Kernel
import tensorflow as tf
hello = tf.constant('Hello Kaggle!')
print(hello.numpy().decode('utf-8'))
Create a TensorFlow constant and evaluate it in Kaggle Kernel.
8
PyTorch Tensor Example in Kaggle Kernel
import torch
tensor = torch.randn(3,3)
print(tensor.shape)
Create a PyTorch tensor and print its shape.
9
Markdown Cell in Kaggle Kernel
# Hello Kaggle
This is a **Markdown** cell in a Kaggle Kernel.
A Markdown cell displaying formatted text in Kaggle Kernel.
10
Plotly Interactive Chart in Kaggle Kernel
import plotly.express as px
import pandas as pd
df = pd.DataFrame({'x':[1,2,3,4], 'y':[10,20,25,30]})
fig = px.line(df, x='x', y='y', title='Interactive Line Plot')
fig.show()
Create an interactive Plotly chart in a Kaggle Kernel.