【问题标题】:How to view .mdb dataset on kaggle?如何在 kaggle 上查看 .mdb 数据集?
【发布时间】:2021-11-29 09:45:32
【问题描述】:

我以这种方式加载这个dataset

Add data > Search for the dataset name (clova deep text ...) > Add

加载数据集并在侧边栏中可见后,我在每个子文件夹中找到了data.mdblock.mdb。我需要检查内容、查看图像、查看标签……我应该如何打开/查看/修改这种奇怪格式的内容?

根据Luke 的建议,我尝试了apt install mbtools,安装开始,系统提示我输入y/n,但无法输入,因为单元格不允许。如果我尝试通过-y,我会得到unrecognized argument 的东西。然后我尝试了以下抱怨丢失包的方法。

pip install mbtools meza
from meza import io    
records = io.read('/kaggle/input/clova-deeptext/clova_deeptext/data_lmdb_release/training/ST/data.mdb')
print(next(records))

结果:

Collecting mbtools
  Downloading mbtools-0.1.1-py3-none-any.whl (3.7 kB)
Collecting meza
  Downloading meza-0.42.5-py2.py3-none-any.whl (55 kB)
     |████████████████████████████████| 55 kB 165 kB/s eta 0:00:01
Collecting ijson<3.0.0,>=2.3
  Downloading ijson-2.6.1-cp37-cp37m-manylinux1_x86_64.whl (65 kB)
     |████████████████████████████████| 65 kB 352 kB/s eta 0:00:01
Collecting python-slugify<2.0.0,>=1.2.5
  Downloading python-slugify-1.2.6.tar.gz (6.8 kB)
Collecting dbfread==2.0.4
  Downloading dbfread-2.0.4-py2.py3-none-any.whl (19 kB)
Requirement already satisfied: beautifulsoup4<5.0.0,>=4.6.0 in /opt/conda/lib/python3.7/site-packages (from meza) (4.10.0)
Collecting pygogo<0.15.0,>=0.13.2
  Downloading pygogo-0.13.2-py2.py3-none-any.whl (20 kB)
Requirement already satisfied: requests<3.0.0,>=2.18.4 in /opt/conda/lib/python3.7/site-packages (from meza) (2.25.1)
Collecting xlrd<2.0.0,>=1.1.0
  Downloading xlrd-1.2.0-py2.py3-none-any.whl (103 kB)
     |████████████████████████████████| 103 kB 1.0 MB/s eta 0:00:01
Requirement already satisfied: PyYAML<6.0.0,>=4.2b1 in /opt/conda/lib/python3.7/site-packages (from meza) (5.4.1)
Collecting chardet<4.0.0,>=3.0.4
  Downloading chardet-3.0.4-py2.py3-none-any.whl (133 kB)
     |████████████████████████████████| 133 kB 987 kB/s eta 0:00:01
Requirement already satisfied: python-dateutil<3.0.0,>=2.7.2 in /opt/conda/lib/python3.7/site-packages (from meza) (2.8.0)
Requirement already satisfied: soupsieve>1.2 in /opt/conda/lib/python3.7/site-packages (from beautifulsoup4<5.0.0,>=4.6.0->meza) (2.2.1)
Requirement already satisfied: six>=1.5 in /opt/conda/lib/python3.7/site-packages (from python-dateutil<3.0.0,>=2.7.2->meza) (1.15.0)
Requirement already satisfied: Unidecode>=0.04.16 in /opt/conda/lib/python3.7/site-packages (from python-slugify<2.0.0,>=1.2.5->meza) (1.2.0)
Requirement already satisfied: idna<3,>=2.5 in /opt/conda/lib/python3.7/site-packages (from requests<3.0.0,>=2.18.4->meza) (2.10)
Requirement already satisfied: certifi>=2017.4.17 in /opt/conda/lib/python3.7/site-packages (from requests<3.0.0,>=2.18.4->meza) (2021.5.30)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /opt/conda/lib/python3.7/site-packages (from requests<3.0.0,>=2.18.4->meza) (1.26.6)
Building wheels for collected packages: python-slugify
  Building wheel for python-slugify (setup.py) ... done
  Created wheel for python-slugify: filename=python_slugify-1.2.6-py2.py3-none-any.whl size=4609 sha256=8c4763108a666b347806541ae6fa0fb59656f9ea38406507f7c83fd06d7621e9
  Stored in directory: /root/.cache/pip/wheels/c5/02/83/9904a9436aa0205c8daa9127109e9ed50d3eab25a5ea2fcb9f
Successfully built python-slugify
Installing collected packages: chardet, xlrd, python-slugify, pygogo, ijson, dbfread, meza, mbtools
  Attempting uninstall: chardet
    Found existing installation: chardet 4.0.0
    Uninstalling chardet-4.0.0:
      Successfully uninstalled chardet-4.0.0
  Attempting uninstall: python-slugify
    Found existing installation: python-slugify 5.0.2
    Uninstalling python-slugify-5.0.2:
      Successfully uninstalled python-slugify-5.0.2
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
caip-notebooks-serverextension 1.0.0 requires google-cloud-bigquery-storage, which is not installed.
jupyterlab-git 0.11.0 requires nbdime<2.0.0,>=1.1.0, but you have nbdime 3.1.0 which is incompatible.
gcsfs 2021.7.0 requires fsspec==2021.07.0, but you have fsspec 2021.8.1 which is incompatible.
earthengine-api 0.1.283 requires google-api-python-client<2,>=1.12.1, but you have google-api-python-client 1.8.0 which is incompatible.
aiobotocore 1.4.1 requires botocore<1.20.107,>=1.20.106, but you have botocore 1.21.44 which is incompatible.
Successfully installed chardet-3.0.4 dbfread-2.0.4 ijson-2.6.1 mbtools-0.1.1 meza-0.42.5 pygogo-0.13.2 python-slugify-1.2.6 xlrd-1.2.0
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
You must install [mdbtools](http://sourceforge.net/projects/mdbtools/) in order to use this function

【问题讨论】:

  • 你在使用 Python 吗?
  • 是的,这是笔记本的侧边栏视图

标签: kaggle


【解决方案1】:

尝试使用以下 sn-p:

!sudo apt install mdbtools #  Library that allows access to MDB files programatically
!pip install meza # A Python toolkit for processing tabular data

from meza import io

records = io.read('database.mdb') # Use only file path, not file objects
print(next(records))

【讨论】:

  • 如果它解决了您的问题或对找到您的解决方案最有帮助,请支持并接受此答案(帮助 SO 社区)
  • 当然,我会的。我现在正在检查,但是有一些未知问题导致apt无法连接到ubuntu服务器,所以我会做需要做的事情,然后再试一次
  • 愚蠢的单元格显示Do you want to continue? [Y/n] ,不允许您单击任何位置进行响应。我试过apt install mdbtools -y 问题依然存在
  • 在您的问题中发布问题
  • 使用!pip install mdbtools
猜你喜欢
  • 2022-01-25
  • 2021-10-27
  • 2019-10-29
  • 1970-01-01
  • 2021-01-04
  • 1970-01-01
  • 2023-03-26
  • 2019-01-28
  • 2018-02-09
相关资源
最近更新 更多