Datasets:
Remove "-" causing problems with dataset viewer (#8)
Browse files- update lfs tracking in gitattributes (929680d0ec74222a0d89f842a6cdcad422434b69)
- Replace '-' in 'Collected_by' column to fix dataset viewer rendering (03f93bf7afdab95e7c67e49f13d4a8a6f6f205ee)
- Notebook finding and fixing the '-' in 'Collected_by' column of full and heliconius CSVs (d65770f7a85dae010c6ebfc9592567f472c25ef6)
- .gitattributes +5 -2
- Heliconius_img_master.csv +2 -2
- img_master.csv +2 -2
- notebooks/Data-gen-1-4.ipynb +136 -0
.gitattributes
CHANGED
|
@@ -55,8 +55,11 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 55 |
*.webp filter=lfs diff=lfs merge=lfs -text
|
| 56 |
|
| 57 |
# Large CSVs
|
| 58 |
-
|
| 59 |
-
|
| 60 |
metadata/Jiggins_Zenodo_Master.csv filter=lfs diff=lfs merge=lfs -text
|
| 61 |
deduplication_process/Jiggins_Zenodo_Img_Master_3477891Patch.csv filter=lfs diff=lfs merge=lfs -text
|
| 62 |
deduplication_process/metadata/Jiggins_Zenodo_Img_Master_3477891Patch_downloaded.csv filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
*.webp filter=lfs diff=lfs merge=lfs -text
|
| 56 |
|
| 57 |
# Large CSVs
|
| 58 |
+
img_master.csv filter=lfs diff=lfs merge=lfs -text
|
| 59 |
+
Heliconius_img_master.csv filter=lfs diff=lfs merge=lfs -text
|
| 60 |
metadata/Jiggins_Zenodo_Master.csv filter=lfs diff=lfs merge=lfs -text
|
| 61 |
deduplication_process/Jiggins_Zenodo_Img_Master_3477891Patch.csv filter=lfs diff=lfs merge=lfs -text
|
| 62 |
deduplication_process/metadata/Jiggins_Zenodo_Img_Master_3477891Patch_downloaded.csv filter=lfs diff=lfs merge=lfs -text
|
| 63 |
+
#older copies:
|
| 64 |
+
Jiggins_Zenodo_Img_Master.csv filter=lfs diff=lfs merge=lfs -text
|
| 65 |
+
Jiggins_Heliconius_Master.csv filter=lfs diff=lfs merge=lfs -text
|
Heliconius_img_master.csv
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a0c3cedf2f8eaeab9763f333a69e157753085a9f3e979b9e49147e895c3427f0
|
| 3 |
+
size 13683556
|
img_master.csv
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a0018cb09605ab1eb1ecbfd8dbe631537ea0d3ac6da28afe2e7a2ee897b4113f
|
| 3 |
+
size 16639721
|
notebooks/Data-gen-1-4.ipynb
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "code",
|
| 5 |
+
"execution_count": 1,
|
| 6 |
+
"metadata": {},
|
| 7 |
+
"outputs": [],
|
| 8 |
+
"source": [
|
| 9 |
+
"import pandas as pd\n",
|
| 10 |
+
"import numpy as np"
|
| 11 |
+
]
|
| 12 |
+
},
|
| 13 |
+
{
|
| 14 |
+
"cell_type": "markdown",
|
| 15 |
+
"metadata": {},
|
| 16 |
+
"source": [
|
| 17 |
+
"# Fix \"-\" in \"Collected_by\" Columns in full_master and Heliconius subsets\n",
|
| 18 |
+
"\n",
|
| 19 |
+
"See [discussion](https://huggingface.co/datasets/imageomics/Heliconius-Collection_Cambridge-Butterfly/discussions/7). I then tested each column that showed up as \"null\" in type on the dataset viewer (searching for df[col] == \"-\")."
|
| 20 |
+
]
|
| 21 |
+
},
|
| 22 |
+
{
|
| 23 |
+
"cell_type": "code",
|
| 24 |
+
"execution_count": 2,
|
| 25 |
+
"metadata": {},
|
| 26 |
+
"outputs": [],
|
| 27 |
+
"source": [
|
| 28 |
+
"# while main is commit 3264ec40dbc9db025e027ddb2abca0914cd6500f\n",
|
| 29 |
+
"df = pd.read_csv(\"https://huggingface.co/datasets/imageomics/Heliconius-Collection_Cambridge-Butterfly/resolve/main/img_master.csv\", low_memory= False)\n",
|
| 30 |
+
"df_heli = pd.read_csv(\"https://huggingface.co/datasets/imageomics/Heliconius-Collection_Cambridge-Butterfly/resolve/main/Heliconius_img_master.csv\", low_memory=False)"
|
| 31 |
+
]
|
| 32 |
+
},
|
| 33 |
+
{
|
| 34 |
+
"cell_type": "code",
|
| 35 |
+
"execution_count": 3,
|
| 36 |
+
"metadata": {},
|
| 37 |
+
"outputs": [
|
| 38 |
+
{
|
| 39 |
+
"name": "stdout",
|
| 40 |
+
"output_type": "stream",
|
| 41 |
+
"text": [
|
| 42 |
+
"column Collected_by has 62 instances of '-'\n"
|
| 43 |
+
]
|
| 44 |
+
}
|
| 45 |
+
],
|
| 46 |
+
"source": [
|
| 47 |
+
"for col in list(df.columns):\n",
|
| 48 |
+
" temp = df.loc[df[col] == \"-\"]\n",
|
| 49 |
+
" if temp.shape[0] > 0:\n",
|
| 50 |
+
" print(f\"column {col} has {temp.shape[0]} instances of '-'\")"
|
| 51 |
+
]
|
| 52 |
+
},
|
| 53 |
+
{
|
| 54 |
+
"cell_type": "code",
|
| 55 |
+
"execution_count": 4,
|
| 56 |
+
"metadata": {},
|
| 57 |
+
"outputs": [
|
| 58 |
+
{
|
| 59 |
+
"name": "stdout",
|
| 60 |
+
"output_type": "stream",
|
| 61 |
+
"text": [
|
| 62 |
+
"column Collected_by has 62 instances of '-'\n"
|
| 63 |
+
]
|
| 64 |
+
}
|
| 65 |
+
],
|
| 66 |
+
"source": [
|
| 67 |
+
"for col in list(df_heli.columns):\n",
|
| 68 |
+
" temp = df_heli.loc[df_heli[col] == \"-\"]\n",
|
| 69 |
+
" if temp.shape[0] > 0:\n",
|
| 70 |
+
" print(f\"column {col} has {temp.shape[0]} instances of '-'\")"
|
| 71 |
+
]
|
| 72 |
+
},
|
| 73 |
+
{
|
| 74 |
+
"cell_type": "markdown",
|
| 75 |
+
"metadata": {},
|
| 76 |
+
"source": [
|
| 77 |
+
"Looks like we just need to fix the `Collected_by` column for both CSVs. We'll replace these with `null` so that it doesn't break the dataset viewer."
|
| 78 |
+
]
|
| 79 |
+
},
|
| 80 |
+
{
|
| 81 |
+
"cell_type": "code",
|
| 82 |
+
"execution_count": 5,
|
| 83 |
+
"metadata": {},
|
| 84 |
+
"outputs": [],
|
| 85 |
+
"source": [
|
| 86 |
+
"df.loc[df[\"Collected_by\"] == \"-\", \"Collected_by\"] = np.nan\n",
|
| 87 |
+
"df_heli.loc[df_heli[\"Collected_by\"] == \"-\", \"Collected_by\"] = np.nan"
|
| 88 |
+
]
|
| 89 |
+
},
|
| 90 |
+
{
|
| 91 |
+
"cell_type": "markdown",
|
| 92 |
+
"metadata": {},
|
| 93 |
+
"source": [
|
| 94 |
+
"## Now let's save the fix"
|
| 95 |
+
]
|
| 96 |
+
},
|
| 97 |
+
{
|
| 98 |
+
"cell_type": "code",
|
| 99 |
+
"execution_count": 6,
|
| 100 |
+
"metadata": {},
|
| 101 |
+
"outputs": [],
|
| 102 |
+
"source": [
|
| 103 |
+
"df.to_csv(\"../img_master.csv\", index = False)\n",
|
| 104 |
+
"df_heli.to_csv(\"../Heliconius_img_master.csv\", index = False)"
|
| 105 |
+
]
|
| 106 |
+
},
|
| 107 |
+
{
|
| 108 |
+
"cell_type": "code",
|
| 109 |
+
"execution_count": null,
|
| 110 |
+
"metadata": {},
|
| 111 |
+
"outputs": [],
|
| 112 |
+
"source": []
|
| 113 |
+
}
|
| 114 |
+
],
|
| 115 |
+
"metadata": {
|
| 116 |
+
"kernelspec": {
|
| 117 |
+
"display_name": "std",
|
| 118 |
+
"language": "python",
|
| 119 |
+
"name": "python3"
|
| 120 |
+
},
|
| 121 |
+
"language_info": {
|
| 122 |
+
"codemirror_mode": {
|
| 123 |
+
"name": "ipython",
|
| 124 |
+
"version": 3
|
| 125 |
+
},
|
| 126 |
+
"file_extension": ".py",
|
| 127 |
+
"mimetype": "text/x-python",
|
| 128 |
+
"name": "python",
|
| 129 |
+
"nbconvert_exporter": "python",
|
| 130 |
+
"pygments_lexer": "ipython3",
|
| 131 |
+
"version": "3.11.3"
|
| 132 |
+
}
|
| 133 |
+
},
|
| 134 |
+
"nbformat": 4,
|
| 135 |
+
"nbformat_minor": 2
|
| 136 |
+
}
|