'Laravel Tinker immediately exits after first command [duplicate]

Whenever I type php artisan tinker, the shell comes up, but whenever I type in any commands and hit the ENTER key, it immediately exits back to the command prompt. Why?

enter image description here



Solution 1:[1]

Please be sure to provide a valid dictionary in your example. Fixing yours and reading into dataframe, you filter based on your conditions

d = {"values_updated_at": "2022-01-06T20:17:02.000+01:00",
    "values": [
      {
        "value": 274.38,
        "datetime": "2022-01-06T01:00:00.000+01:00",
        "datetime_utc": "2022-01-06T00:00:00Z",
        "tz_time": "2022-01-06T00:00:00.000Z",
        "geo_id": 8741,
        "geo_name": "US"
      },
      {
        "value": 274.38,
        "datetime": "2022-01-06T01:00:00.000+01:00",
        "datetime_utc": "2022-01-06T00:00:00Z",
        "tz_time": "2022-01-06T00:00:00.000Z",
        "geo_id": 8742,
        "geo_name": "UK"
      },
      {
        "value": 274.38,
        "datetime": "2022-01-06T01:00:00.000+01:00",
        "datetime_utc": "2022-01-06T00:00:00Z",
        "tz_time": "2022-01-06T00:00:00.000Z",
        "geo_id": 8743,
        "geo_name": "Spain"
      }]}
df = pd.DataFrame(d['values'])
df[df['geo_name']=='US']


    value                       datetime          datetime_utc                   tz_time  geo_id geo_name
0  274.38  2022-01-06T01:00:00.000+01:00  2022-01-06T00:00:00Z  2022-01-06T00:00:00.000Z    8741       US

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jonathan Leon