Question: I'm getting data from a remote server using a REST API and getting a JSON response.
After some initial manipulation and pulling specific data from it, I'm creating a dataframe that will then be saved to a database.

The problem is that each value is a single item list, either a float or the string None, i.e. [None]

Simple code to replicate what I'm seeing:

```
import pandas as pd

columns = ['Acct1', 'Acct2', 'Acct3']
idx = ['Srv1', 'Srv2', 'Srv3']
single_data = [[1.24567],[None],[-.002345]]
data_list = []
for i in range(3):
    data_list.append(single_data)

df = pd.DataFrame(data=data_list, columns=columns, index=idx)

print(df)

     Acct1   Acct2        Acct3
Srv1  [1.24567]  [None]  [-0.002345]
Srv2  [1.24567]  [None]  [-0.002345]
Srv3  [1.24567]  [None]  [-0.002345]

```

I'm trying to figure out the best way to convert this so that in the end the data will all be floats, not lists.

Answer: 
You can transform your dataframe:

```
print(df.transform(lambda x: [v[0] for v in x]))

```

Prints:

```
        Acct1 Acct2     Acct3
Srv1  1.24567  None -0.002345
Srv2  1.24567  None -0.002345
Srv3  1.24567  None -0.002345

```

---

Or add to `data_list` just one `list`, e.g.:

```
columns = ["Acct1", "Acct2", "Acct3"]
idx = ["Srv1", "Srv2", "Srv3"]
single_data = [[1.24567], [None], [-0.002345]]
data_list = []
for i in range(3):
    data_list.append([i[0] for i in single_data])

df = pd.DataFrame(data=data_list, columns=columns, index=idx)
print(df)

```
You can also use do:

```
df = df.applymap(lambda x: pd.to_numeric(x[0], errors='coerce'))

```

Output:

```
          Acct1  Acct2      Acct3
Srv1    1.24567    NaN  -0.002345
Srv2    1.24567    NaN  -0.002345
Srv3    1.24567    NaN  -0.002345

```

If you want to have 'None' instead of NaN, you can add "fillna('None')" at the end.