From davidgshi at yahoo.co.uk  Fri Oct  2 08:17:41 2020
From: davidgshi at yahoo.co.uk (davidgshi at yahoo.co.uk)
Date: Fri, 2 Oct 2020 12:17:41 +0000 (UTC)
Subject: [IPython-dev] ValueError: arrays must all be same length
In-Reply-To: <CA+i5Jwa4LxNZFwCGGbyfVFZO3YmFdPD2FnOQFsmm_DG_MVKRPQ@mail.gmail.com>
References: <CA+i5JwbLEZ+XHNurs3+eOS4vis2hEcVs6Qanpa=_sHk8mtQyhA@mail.gmail.com>
 <CA+i5Jwa4LxNZFwCGGbyfVFZO3YmFdPD2FnOQFsmm_DG_MVKRPQ@mail.gmail.com>
Message-ID: <2029160029.1762793.1601641061894@mail.yahoo.com>

 Hello,

I got a json response from an API and tried to use pandas to put data into a dataframe.
However, I kept getting this?ValueError: arrays must all be same length.
Can anyone help?
The following is the json text.? Regards, Shao
{
  "locationId": "1-1004508435",
  "providerId": "1-101641521",
  "organisationType": "Location",
  "type": "Social Care Org",
  "name": "Meadow Rose Nursing Home",
  "brandId": "BD510",
  "brandName": "BRAND MACC Care",
  "onspdCcgCode": "E38000220",
  "onspdCcgName": "NHS Birmingham and Solihull CCG",
  "odsCode": "VM4G9",
  "uprn": "100070537642",
  "registrationStatus": "Registered",
  "registrationDate": "2013-12-16",
  "dormancy": "N",
  "numberOfBeds": 56,
  "postalAddressLine1": "96 The Roundabout",
  "postalAddressTownCity": "Birmingham",
  "postalAddressCounty": "West Midlands",
  "region": "West Midlands",
  "postalCode": "B31 2TX",
  "onspdLatitude": 52.399843,
  "onspdLongitude": -1.989241,
  "careHome": "Y",
  "inspectionDirectorate": "Adult social care",
  "mainPhoneNumber": "01214769808",
  "constituency": "Birmingham, Northfield",
  "localAuthority": "Birmingham",
  "lastInspection": {
    "date": "2020-06-24"
  },
  "lastReport": {
    "publicationDate": "2020-10-01"
  },
  "relationships": [
    
  ],
  "locationTypes": [
    
  ],
  "regulatedActivities": [
    {
      "name": "Accommodation for persons who require nursing or personal care",
      "code": "RA2",
      "contacts": [
        {
          "personTitle": "Mr",
          "personGivenName": "Steven",
          "personFamilyName": "Kazembe",
          "personRoles": [
            "Registered Manager"
          ]
        }
      ]
    },
    {
      "name": "Treatment of disease, disorder or injury",
      "code": "RA5",
      "contacts": [
        {
          "personTitle": "Mr",
          "personGivenName": "Steven",
          "personFamilyName": "Kazembe",
          "personRoles": [
            "Registered Manager"
          ]
        }
      ]
    }
  ],
  "gacServiceTypes": [
    {
      "name": "Nursing homes",
      "description": "Care home service with nursing"
    }
  ],
  "inspectionCategories": [
    {
      "code": "S1",
      "primary": "true",
      "name": "Residential social care"
    }
  ],
  "specialisms": [
    {
      "name": "Caring for adults over 65 yrs"
    },
    {
      "name": "Caring for adults under 65 yrs"
    },
    {
      "name": "Dementia"
    },
    {
      "name": "Physical disabilities"
    }
  ],
  "inspectionAreas": [
    
  ],
  "currentRatings": {
    "overall": {
      "rating": "Requires improvement",
      "reportDate": "2020-10-01",
      "reportLinkId": "1157c975-c2f1-423e-a2b4- 66901779e014",
      "useOfResources": {
        
      },
      "keyQuestionRatings": [
        {
          "name": "Safe",
          "rating": "Requires improvement",
          "reportDate": "2020-10-01",
          "reportLinkId": "1157c975-c2f1-423e-a2b4- 66901779e014"
        },
        {
          "name": "Well-led",
          "rating": "Requires improvement",
          "reportDate": "2020-10-01",
          "reportLinkId": "1157c975-c2f1-423e-a2b4- 66901779e014"
        },
        {
          "name": "Caring",
          "rating": "Good",
          "reportDate": "2019-10-04",
          "reportLinkId": "63ff05ec-4d31-406e-83de- 49a271cfdc43"
        },
        {
          "name": "Responsive",
          "rating": "Good",
          "reportDate": "2019-10-04",
          "reportLinkId": "63ff05ec-4d31-406e-83de- 49a271cfdc43"
        },
        {
          "name": "Effective",
          "rating": "Requires improvement",
          "reportDate": "2019-10-04",
          "reportLinkId": "63ff05ec-4d31-406e-83de- 49a271cfdc43"
        }
      ]
    },
    "reportDate": "2020-10-01"
  },
  "historicRatings": [
    {
      "reportLinkId": "63ff05ec-4d31-406e-83de- 49a271cfdc43",
      "reportDate": "2019-10-04",
      "overall": {
        "rating": "Requires improvement",
        "keyQuestionRatings": [
          {
            "name": "Safe",
            "rating": "Requires improvement"
          },
          {
            "name": "Well-led",
            "rating": "Requires improvement"
          }
        ]
      }
    },
    {
      "reportLinkId": "4f20da40-89a4-4c45-a7f9- bfd52b48f286",
      "reportDate": "2017-09-08",
      "overall": {
        "rating": "Good",
        "keyQuestionRatings": [
          {
            "name": "Safe",
            "rating": "Good"
          },
          {
            "name": "Well-led",
            "rating": "Good"
          },
          {
            "name": "Caring",
            "rating": "Good"
          },
          {
            "name": "Responsive",
            "rating": "Good"
          },
          {
            "name": "Effective",
            "rating": "Requires improvement"
          }
        ]
      }
    },
    {
      "reportLinkId": "0cc4226b-401e-4f0f-ba35- 062cbadffa8f",
      "reportDate": "2016-06-11",
      "overall": {
        "rating": "Requires improvement",
        "keyQuestionRatings": [
          {
            "name": "Safe",
            "rating": "Requires improvement"
          },
          {
            "name": "Well-led",
            "rating": "Requires improvement"
          },
          {
            "name": "Caring",
            "rating": "Requires improvement"
          },
          {
            "name": "Responsive",
            "rating": "Requires improvement"
          },
          {
            "name": "Effective",
            "rating": "Good"
          }
        ]
      }
    },
    {
      "reportLinkId": "a11c1e52-ddfd-4cd8-8b56- 1b96ac287c96",
      "reportDate": "2015-01-12",
      "overall": {
        "rating": "Good",
        "keyQuestionRatings": [
          {
            "name": "Safe",
            "rating": "Good"
          },
          {
            "name": "Well-led",
            "rating": "Good"
          },
          {
            "name": "Caring",
            "rating": "Good"
          },
          {
            "name": "Responsive",
            "rating": "Requires improvement"
          },
          {
            "name": "Effective",
            "rating": "Good"
          }
        ]
      }
    }
  ],
  "reports": [
    {
      "linkId": "1157c975-c2f1-423e-a2b4- 66901779e014",
      "reportDate": "2020-10-01",
      "reportUri": "/reports/1157c975-c2f1-423e- a2b4-66901779e014",
      "firstVisitDate": "2020-06-23",
      "reportType": "Location"
    },
    {
      "linkId": "63ff05ec-4d31-406e-83de- 49a271cfdc43",
      "reportDate": "2019-10-04",
      "reportUri": "/reports/63ff05ec-4d31-406e- 83de-49a271cfdc43",
      "firstVisitDate": "2019-08-28",
      "reportType": "Location"
    },
    {
      "linkId": "4f20da40-89a4-4c45-a7f9- bfd52b48f286",
      "reportDate": "2017-09-08",
      "reportUri": "/reports/4f20da40-89a4-4c45- a7f9-bfd52b48f286",
      "firstVisitDate": "2017-07-19",
      "reportType": "Location"
    },
    {
      "linkId": "0cc4226b-401e-4f0f-ba35- 062cbadffa8f",
      "reportDate": "2016-06-11",
      "reportUri": "/reports/0cc4226b-401e-4f0f- ba35-062cbadffa8f",
      "firstVisitDate": "2016-03-15",
      "reportType": "Location"
    },
    {
      "linkId": "a11c1e52-ddfd-4cd8-8b56- 1b96ac287c96",
      "reportDate": "2015-01-12",
      "reportUri": "/reports/a11c1e52-ddfd-4cd8- 8b56-1b96ac287c96",
      "firstVisitDate": "2014-08-12",
      "reportType": "Location"
    }
  ]
}
In?[?]:?In?[25]:j?import pandas as pdimport jsonj = json.JSONDecoder().decode(req. text)  ###req.jsondf = pd.DataFrame.from_dict(j)


  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20201002/becb56c8/attachment.html>

From erik.m.bray at gmail.com  Fri Oct  2 12:44:31 2020
From: erik.m.bray at gmail.com (E. Madison Bray)
Date: Fri, 2 Oct 2020 18:44:31 +0200
Subject: [IPython-dev] ValueError: arrays must all be same length
In-Reply-To: <2029160029.1762793.1601641061894@mail.yahoo.com>
References: <CA+i5JwbLEZ+XHNurs3+eOS4vis2hEcVs6Qanpa=_sHk8mtQyhA@mail.gmail.com>
 <CA+i5Jwa4LxNZFwCGGbyfVFZO3YmFdPD2FnOQFsmm_DG_MVKRPQ@mail.gmail.com>
 <2029160029.1762793.1601641061894@mail.yahoo.com>
Message-ID: <CAOTD34ZoG5KtfJE1YeDeadgjK-CwR+PACtHoaLb7HFGmCTCRvQ@mail.gmail.com>

Hello,

This (mostly defunct) mailing list is for discussing use and
development of IPython; it is not for help with general programming
questions.

The error you're getting is because DataFrame.from_dict [1] doesn't
somehow convert any arbitrary structure of nested dictionaries to a
DataFrame.  It expects a dict mapping column names to homogeneously
sized lists/arrays forming the data for those columns.

If you need more follow-up help try stackoverflow.com

[1] https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.from_dict.html

On Fri, Oct 2, 2020 at 2:17 PM davidgshi at yahoo.co.uk
<davidgshi at yahoo.co.uk> wrote:
>
> Hello,
>
> I got a json response from an API and tried to use pandas to put data into a dataframe.
>
> However, I kept getting this ValueError: arrays must all be same length.
>
> Can anyone help?
>
> The following is the json text.  Regards, Shao
>
> {
>   "locationId": "1-1004508435",
>   "providerId": "1-101641521",
>   "organisationType": "Location",
>   "type": "Social Care Org",
>   "name": "Meadow Rose Nursing Home",
>   "brandId": "BD510",
>   "brandName": "BRAND MACC Care",
>   "onspdCcgCode": "E38000220",
>   "onspdCcgName": "NHS Birmingham and Solihull CCG",
>   "odsCode": "VM4G9",
>   "uprn": "100070537642",
>   "registrationStatus": "Registered",
>   "registrationDate": "2013-12-16",
>   "dormancy": "N",
>   "numberOfBeds": 56,
>   "postalAddressLine1": "96 The Roundabout",
>   "postalAddressTownCity": "Birmingham",
>   "postalAddressCounty": "West Midlands",
>   "region": "West Midlands",
>   "postalCode": "B31 2TX",
>   "onspdLatitude": 52.399843,
>   "onspdLongitude": -1.989241,
>   "careHome": "Y",
>   "inspectionDirectorate": "Adult social care",
>   "mainPhoneNumber": "01214769808",
>   "constituency": "Birmingham, Northfield",
>   "localAuthority": "Birmingham",
>   "lastInspection": {
>     "date": "2020-06-24"
>   },
>   "lastReport": {
>     "publicationDate": "2020-10-01"
>   },
>   "relationships": [
>
>   ],
>   "locationTypes": [
>
>   ],
>   "regulatedActivities": [
>     {
>       "name": "Accommodation for persons who require nursing or personal care",
>       "code": "RA2",
>       "contacts": [
>         {
>           "personTitle": "Mr",
>           "personGivenName": "Steven",
>           "personFamilyName": "Kazembe",
>           "personRoles": [
>             "Registered Manager"
>           ]
>         }
>       ]
>     },
>     {
>       "name": "Treatment of disease, disorder or injury",
>       "code": "RA5",
>       "contacts": [
>         {
>           "personTitle": "Mr",
>           "personGivenName": "Steven",
>           "personFamilyName": "Kazembe",
>           "personRoles": [
>             "Registered Manager"
>           ]
>         }
>       ]
>     }
>   ],
>   "gacServiceTypes": [
>     {
>       "name": "Nursing homes",
>       "description": "Care home service with nursing"
>     }
>   ],
>   "inspectionCategories": [
>     {
>       "code": "S1",
>       "primary": "true",
>       "name": "Residential social care"
>     }
>   ],
>   "specialisms": [
>     {
>       "name": "Caring for adults over 65 yrs"
>     },
>     {
>       "name": "Caring for adults under 65 yrs"
>     },
>     {
>       "name": "Dementia"
>     },
>     {
>       "name": "Physical disabilities"
>     }
>   ],
>   "inspectionAreas": [
>
>   ],
>   "currentRatings": {
>     "overall": {
>       "rating": "Requires improvement",
>       "reportDate": "2020-10-01",
>       "reportLinkId": "1157c975-c2f1-423e-a2b4- 66901779e014",
>       "useOfResources": {
>
>       },
>       "keyQuestionRatings": [
>         {
>           "name": "Safe",
>           "rating": "Requires improvement",
>           "reportDate": "2020-10-01",
>           "reportLinkId": "1157c975-c2f1-423e-a2b4- 66901779e014"
>         },
>         {
>           "name": "Well-led",
>           "rating": "Requires improvement",
>           "reportDate": "2020-10-01",
>           "reportLinkId": "1157c975-c2f1-423e-a2b4- 66901779e014"
>         },
>         {
>           "name": "Caring",
>           "rating": "Good",
>           "reportDate": "2019-10-04",
>           "reportLinkId": "63ff05ec-4d31-406e-83de- 49a271cfdc43"
>         },
>         {
>           "name": "Responsive",
>           "rating": "Good",
>           "reportDate": "2019-10-04",
>           "reportLinkId": "63ff05ec-4d31-406e-83de- 49a271cfdc43"
>         },
>         {
>           "name": "Effective",
>           "rating": "Requires improvement",
>           "reportDate": "2019-10-04",
>           "reportLinkId": "63ff05ec-4d31-406e-83de- 49a271cfdc43"
>         }
>       ]
>     },
>     "reportDate": "2020-10-01"
>   },
>   "historicRatings": [
>     {
>       "reportLinkId": "63ff05ec-4d31-406e-83de- 49a271cfdc43",
>       "reportDate": "2019-10-04",
>       "overall": {
>         "rating": "Requires improvement",
>         "keyQuestionRatings": [
>           {
>             "name": "Safe",
>             "rating": "Requires improvement"
>           },
>           {
>             "name": "Well-led",
>             "rating": "Requires improvement"
>           }
>         ]
>       }
>     },
>     {
>       "reportLinkId": "4f20da40-89a4-4c45-a7f9- bfd52b48f286",
>       "reportDate": "2017-09-08",
>       "overall": {
>         "rating": "Good",
>         "keyQuestionRatings": [
>           {
>             "name": "Safe",
>             "rating": "Good"
>           },
>           {
>             "name": "Well-led",
>             "rating": "Good"
>           },
>           {
>             "name": "Caring",
>             "rating": "Good"
>           },
>           {
>             "name": "Responsive",
>             "rating": "Good"
>           },
>           {
>             "name": "Effective",
>             "rating": "Requires improvement"
>           }
>         ]
>       }
>     },
>     {
>       "reportLinkId": "0cc4226b-401e-4f0f-ba35- 062cbadffa8f",
>       "reportDate": "2016-06-11",
>       "overall": {
>         "rating": "Requires improvement",
>         "keyQuestionRatings": [
>           {
>             "name": "Safe",
>             "rating": "Requires improvement"
>           },
>           {
>             "name": "Well-led",
>             "rating": "Requires improvement"
>           },
>           {
>             "name": "Caring",
>             "rating": "Requires improvement"
>           },
>           {
>             "name": "Responsive",
>             "rating": "Requires improvement"
>           },
>           {
>             "name": "Effective",
>             "rating": "Good"
>           }
>         ]
>       }
>     },
>     {
>       "reportLinkId": "a11c1e52-ddfd-4cd8-8b56- 1b96ac287c96",
>       "reportDate": "2015-01-12",
>       "overall": {
>         "rating": "Good",
>         "keyQuestionRatings": [
>           {
>             "name": "Safe",
>             "rating": "Good"
>           },
>           {
>             "name": "Well-led",
>             "rating": "Good"
>           },
>           {
>             "name": "Caring",
>             "rating": "Good"
>           },
>           {
>             "name": "Responsive",
>             "rating": "Requires improvement"
>           },
>           {
>             "name": "Effective",
>             "rating": "Good"
>           }
>         ]
>       }
>     }
>   ],
>   "reports": [
>     {
>       "linkId": "1157c975-c2f1-423e-a2b4- 66901779e014",
>       "reportDate": "2020-10-01",
>       "reportUri": "/reports/1157c975-c2f1-423e- a2b4-66901779e014",
>       "firstVisitDate": "2020-06-23",
>       "reportType": "Location"
>     },
>     {
>       "linkId": "63ff05ec-4d31-406e-83de- 49a271cfdc43",
>       "reportDate": "2019-10-04",
>       "reportUri": "/reports/63ff05ec-4d31-406e- 83de-49a271cfdc43",
>       "firstVisitDate": "2019-08-28",
>       "reportType": "Location"
>     },
>     {
>       "linkId": "4f20da40-89a4-4c45-a7f9- bfd52b48f286",
>       "reportDate": "2017-09-08",
>       "reportUri": "/reports/4f20da40-89a4-4c45- a7f9-bfd52b48f286",
>       "firstVisitDate": "2017-07-19",
>       "reportType": "Location"
>     },
>     {
>       "linkId": "0cc4226b-401e-4f0f-ba35- 062cbadffa8f",
>       "reportDate": "2016-06-11",
>       "reportUri": "/reports/0cc4226b-401e-4f0f- ba35-062cbadffa8f",
>       "firstVisitDate": "2016-03-15",
>       "reportType": "Location"
>     },
>     {
>       "linkId": "a11c1e52-ddfd-4cd8-8b56- 1b96ac287c96",
>       "reportDate": "2015-01-12",
>       "reportUri": "/reports/a11c1e52-ddfd-4cd8- 8b56-1b96ac287c96",
>       "firstVisitDate": "2014-08-12",
>       "reportType": "Location"
>     }
>   ]
> }
>
> In [ ]:
>
>
> In [25]:
> j
>
>
> import pandas as pd
>
> import json
>
> j = json.JSONDecoder().decode(req. text)  ###req.json
>
> df = pd.DataFrame.from_dict(j)
>
>
>
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at python.org
> https://mail.python.org/mailman/listinfo/ipython-dev

From varunaseneviratna at gmail.com  Sun Oct 11 04:25:03 2020
From: varunaseneviratna at gmail.com (Varuna Seneviratna)
Date: Sun, 11 Oct 2020 13:55:03 +0530
Subject: [IPython-dev] Why doesn't Jupyter Noebook display auto complete
Message-ID: <CAKW-c0ydKbkYj0n=ewkHLcTeENGp6m__yTparJmNDdx=c9Yf7w@mail.gmail.com>

Hello,
          I have installed Anaconda3, the free version for individuals. The
problem is, if the Jupyter Notebook is started from the cmd, the
auto-complete doesn't get displayed. But if the Jupyter Notebook is
started from within Anaconda3 command prompt, the auto complete is
displayed. And why doesn't it also, when a downloaded Jupyter Notebook file
is opened, then too, the auto complete doesn't get displayed.

How to get auto-complete displayed?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20201011/d52b272c/attachment.html>