将文件作为pandas数据帧读取时出错

时间:2017-11-22 15:49:55

标签: python python-3.x pandas

我正在尝试打开包含文本的文件,如下所示:

Pubmed-entry ::= {
  pmid 28038481,
  medent {
    em std {
      year 2016,
      month 12,
      day 30
    },
    cit {
      title {
        name "Selective Brain Cooling after Traumatic Brain Injury: Effects of
 Three Different Cooling Methods-Case Report."
      },
      authors {
        names std {
          {
            name ml "Westermaier T",
            affil str "Department of Neurosurgery, University Hospital
 Wuerzburg, Wuerzburg, Germany."
          },
          {
            name ml "Nickl R",
            affil str "Department of Neurosurgery, University Hospital
 Wuerzburg, Wuerzburg, Germany."
          },
          {
            name ml "Koehler S",
            affil str "Department of Neurosurgery, University Hospital
 Wuerzburg, Wuerzburg, Germany."
          },
          {
            name ml "Fricke P",
            affil str "Department of Neurosurgery, University Hospital
 Wuerzburg, Wuerzburg, Germany."
          },
          {
            name ml "Stetter C",
            affil str "Department of Neurosurgery, University Hospital
 Wuerzburg, Wuerzburg, Germany."
          },
          {
            name ml "Rueckriegel SM",
            affil str "Department of Neurosurgery, University Hospital
 Wuerzburg, Wuerzburg, Germany."
          },
          {
            name ml "Ernestus RI",
            affil str "Department of Neurosurgery, University Hospital
 Wuerzburg, Wuerzburg, Germany."
          }
        }
      },
      from journal {
        title {
          iso-jta "J Neurol Surg A Cent Eur Neurosurg",
          ml-jta "J Neurol Surg A Cent Eur Neurosurg",
          issn "2193-6323",
          name "Journal of neurological surgery. Part A, Central European
 neurosurgery"
        },
        imp {
          date std {
            year 2017,
            month 7
          },
          volume "78",
          issue "4",
          pages "397-402",
          language "eng",
          pubstatus ppublish,
          history {
            {
              pubstatus pubmed,
              date std {
                year 2016,
                month 12,
                day 31,
                hour 6,
                minute 0
              }
            },
            {
              pubstatus medline,
              date std {
                year 2017,
                month 10,
                day 14,
                hour 6,
                minute 0
              }
            },
            {
              pubstatus other,
              date std {
                year 2016,
                month 12,
                day 31,
                hour 6,
                minute 0
              }
            }
          }
        }
      },
      ids {
        pubmed 28038481,
        doi "10.1055/s-0036-1596057",
        other {
          db "ELocationID doi",
          tag str "10.1055/s-0036-1596057"
        }
      }
    },
    abstract "Background In experimental models of neuronal damage,
 therapeutic hypothermia proved to be a powerful neuroprotective method. In
 clinical studies of traumatic brain injury (TBI), this very distinct effect
 was not reproducible. Several meta-analyses draw different conclusions about
 whether therapeutic hypothermia can improve outcome after TBI. Adverse side
 effects of systemic hypothermia, such as severe pneumonia, have been held
 responsible by some authors to counteract the neuroprotective effect.
 Selective brain cooling (SBC) attempts to take advantage of the protective
 effects of therapeutic hypothermia without the adverse side effects of
 systemic hypothermia. Methods Three different methods of SBC were applied in
 a patient who had severe TBI with recurrent increases of intracranial
 pressure (ICP) refractory to conventional forms of treatment: (1) external
 cooling of the scalp and neck using ice packs prior to hemicraniectomy, (2)
 external cooling of the craniectomy defect using ice packs after
 hemicraniectomy, and (3) cooling by epidural irrigation with cold Ringer
 solution after hemicraniectomy. Results External scalp cooling before
 hemicraniectomy, external cooling of the craniectomy defect, and epidural
 irrigation with cold fluid resulted in temperature differences (brain
 temperature to body temperature) of - 0.2 degrees , - 0.7 degrees , and - 3.6
 degrees C, respectively. ICP declined with decreasing brain temperature.
 Conclusion Previous external cooling attempts for SBC faced the problem that
 brain temperature could not be lowered without a simultaneous decrease of
 systemic temperature. After hemicraniectomy, epidural irrigation with cold
 fluid may be a simple and effective way to lower ICP and apply one of the
 most powerful methods of cerebroprotection after severe TBI.",
    mesh {
      {
        term "Brain",
        qual {
          {
            subh "physiopathology"
          },
          {
            subh "surgery"
          }
        }
      },
      {
        term "Brain Injuries, Traumatic",
        qual {
          {
            subh "physiopathology"
          },
          {
            mp TRUE,
            subh "surgery"
          }
        }
      },
      {
        term "Decompressive Craniectomy"
      },
      {
        term "Epidural Space"
      },
      {
        term "Humans"
      },
      {
        term "Hypothermia, Induced",
        qual {
          {
            mp TRUE,
            subh "methods"
          }
        }
      },
      {
        term "Scalp"
      },
      {
        term "Skull"
      },
      {
        term "Therapeutic Irrigation"
      }
    },
    pmid 28038481,
    pub-type {
      "Case Reports",
      "Journal Article"
    },
    status medline
  }
}



Pubmed-entry ::= {mid 28038480, ------------etc

我无法加载文件(我尝试使用方向w /列,记录等)

data = pd.read_json('data/NCBI/pubmed_batch_10000_to_19999.json.json', orient='index')

我得到了

  

ValueError:预期的对象或值

with open('data/NCBI/pubmed_batch_0_to_9999.json', encoding='utf-8') as data_file:
    data = json.loads(data_file.read())

我得到了

  

JSONDecodeError:期望值:第1行第1列(字符0)

我知道它不是json而是asn1文件,但是如何将其作为数据框加载?

谢谢

0 个答案:

没有答案