The dataset viewer is not available for this split.
Error code: TooManyColumnsError
Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.
A curation of datasets for educations purposes.
California Housing
Since SciKit Learn's California Housing dataset often fails to download this is the Data Frame of the data in CSV format.
By default SciKit Learn use some pre processing of the original data.
This CSV is the data after the processing of SciKit Learn.
CIFAR 10
Since using SciKit Learn's fetch_openml() fails to download the CIFAR_10 dataset this is an alternative.
It was generated by:
dsTrain = torchvision.datasets.CIFAR10(root = dataFolderPath, train = True, download = True)
dsVal = torchvision.datasets.CIFAR10(root = dataFolderPath, train = False, download = True)
numSamples = len(dsTrain)
tXTrain = np.zeros((numSamples, 32, 32, 3), dtype = np.uint8)
vYTrain = np.zeros((numSamples,), dtype = np.uint8)
for ii in range(numSamples):
tXi, valY = dsTrain[ii]
tXTrain[ii] = tXi
vYTrain[ii] = valY
numSamples = len(dsVal)
tXVal = np.zeros((numSamples, 32, 32, 3), dtype = np.uint8)
vYVal = np.zeros((numSamples,), dtype = np.uint8)
for ii in range(numSamples):
tXi, valY = dsVal[ii]
tXVal[ii] = tXi
vYVal[ii] = valY
tX = np.concatenate((tXTrain, tXVal), axis = 0)
vY = np.concatenate((vYTrain, vYVal), axis = 0)
mX = np.reshape(tX, (tX.shape[0], -1))
dfData = pd.DataFrame(np.concatenate((mX, vY[:, np.newaxis]), axis = 1), columns = [f'Pixel_{ii:04d}' for ii in range(mX.shape[1])] + ['Label'])
dfData.to_parquet('CIFAR10.parquet', index = False)
MNIST
A dataframe where the first 60,000 rows are the train set and the last 10,000 are the test set.
The last column is the label.
Images are row major, hence a np.reshape(dfX.iloc[0, :-1], (28, 28)) will generate the image.
Generated by:
import numpy as np
from sklearn.datasets import fetch_openml
dfX, dsY = fetch_openml('mnist_784', version = 1, return_X_y = True, as_frame = True)
dfX.columns = [f'{ii:04d}' for ii in range(dfX.shape[1])]
dfX['Label'] = dsY.astype(np.uint8)
dfX = dfX.astype(np.uint8)
dfX.to_parquet('MNIST.parquet', index = False)
Israel Settlements
Generated by:
# Scientific Python
import numpy as np
import scipy as sp
import pandas as pd
# Geo
from geopy.distance import geodesic
# Miscellaneous
from platform import python_version
import random
import requests
numSettlements = 1000
lOverpassEndpoints = [
"https://overpass-api.de/api/interpreter",
"https://overpass.kumi.systems/api/interpreter",
"https://overpass.private.coffee/api/interpreter",
]
overpassQuery = """
[out:json][timeout:120];
(
node["place"~"^(city|town|village)$"](29.4,34.2,33.4,35.9);
way["place"~"^(city|town|village)$"](29.4,34.2,33.4,35.9);
);
out center;
"""
dHeaders = {
"User-Agent": "OverpassQueryClient/1.0",
"Accept": "application/json, text/plain;q=0.9, */*;q=0.8",
"Content-Type": "text/plain; charset=utf-8",
}
dData = None
lastError = None
for overpassUrl in lOverpassEndpoints:
try:
# Send raw Overpass QL as the request body.
postResponse = requests.post(overpassUrl, data=overpassQuery, headers=dHeaders, timeout=180)
postResponse.raise_for_status()
dData = postResponse.json()
print(f"Overpass query succeeded via: {overpassUrl}")
break
except requests.RequestException as ex:
statusCode = getattr(ex.response, "status_code", None)
responseText = ""
if getattr(ex, "response", None) is not None and ex.response is not None:
responseText = ex.response.text[:400]
print(f"Overpass request failed via {overpassUrl} (status={statusCode}): {responseText}")
lastError = ex
if dData is None:
raise RuntimeError("All Overpass endpoints failed") from lastError
lSettlements = []
# Parse the geo-data
for element in dData.get('elements', []):
tags = element.get('tags', {})
# Extract name (prefer English, fallback to default name)
settlementName = tags.get('name:en', tags.get('name'))
# Extract population safely (convert to int)
populationStr = tags.get('population', '0').replace(',', '').split(';')[0]
try:
population = int(populationStr)
except ValueError:
population = 0
# Extract coordinates (ways have a center, nodes have direct lat/lon)
coordLat = element.get('lat', element.get('center', {}).get('lat'))
coordLon = element.get('lon', element.get('center', {}).get('lon'))
if settlementName and coordLat and coordLon:
lSettlements.append({
'name': settlementName,
'population': population,
'lat': coordLat,
'lon': coordLon
})
# Normalize names to have only ASCII characters (remove accents, etc.)
for settlement in lSettlements:
settlement['name'] = settlement['name'].encode('ascii', 'ignore').decode('ascii')
# Convert to DataFrame, drop any duplicates, and sort by largest population
dfSettlement = pd.DataFrame(lSettlements).drop_duplicates(subset = ['name'])
dfSettlement = dfSettlement.sort_values(by = 'population', ascending = False).head(numSettlements)
dfSettlement = dfSettlement.reset_index(drop = True)
lNames = dfSettlement['name'].tolist()
lCoords = list(zip(dfSettlement['lat'], dfSettlement['lon']))
mD = np.zeros((numSettlements, numSettlements))
for ii, coordA in enumerate(lCoords):
for jj, coordB in enumerate(lCoords):
if ii == jj:
continue # Skip distance to self
elif jj < ii:
mD[ii, jj] = mD[jj, ii] # Symmetric
else:
# Matches Google Maps' "Measure Distance" formula
mD[ii, jj] = geodesic(coordA, coordB).kilometers
dfDistance = pd.DataFrame(mD, columns = lNames, index = lNames)
dfSettlement.to_csv(f'Israel{numSettlements}Settlements.csv')
dfDistance.to_csv(f'Israel{numSettlements}SettlementsGeodesicDistances.csv')
dfSettlement.to_parquet(f'Israel{numSettlements}Settlements.parquet')
dfDistance.to_parquet(f'Israel{numSettlements}SettlementsGeodesicDistances.parquet')
- Downloads last month
- 214