# Plotting returns data type issues

**URL:** <https://community.plotly.com/t/plotting-returns-data-type-issues/35730>\
**Category:** 📊 Plotly Python\
**Created:** [March 3, 2020, 12:22am UTC](https://community.plotly.com/t/plotting-returns-data-type-issues/35730 "2020-03-03T00:22:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![spollock](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/spollock/32/9656_2.png) [@spollock](https://community.plotly.com/u/spollock)\
**Post date:** [March 3, 2020, 12:22am UTC](https://community.plotly.com/t/plotting-returns-data-type-issues/35730/1 "2020-03-03T00:22:35Z")

</div>

I am quite new to plotly, hopefully this is not too silly of a question.

Pulling data from mysql:

```auto
df = pd.DataFrame( [[ij for ij in i] for i in results] )
df.rename(columns={0: 'checkin_time', 1: 'license', 2: 'licensed_endpoints', 3: 'total_endpoints'}, inplace=True);
df = df.sort_values(['checkin_time'], ascending=[0]);
df.head()

```

Returns:

```auto
checkin_time	license	licensed_endpoints	total_endpoints
0	2020-02-26 21:58:28	2264483e-102a-4280-b7a2-8d2dd716936b	340000.0	77085.0
1	2020-02-20 23:49:54	2264483e-102a-4280-b7a2-8d2dd716936b	256000.0	43918.0
2	2020-02-13 23:40:04	2264483e-102a-4280-b7a2-8d2dd716936b	240000.0	43035.0
3	2020-02-06 23:42:51	2264483e-102a-4280-b7a2-8d2dd716936b	240000.0	64893.0
4	2020-01-30 23:54:08	2264483e-102a-4280-b7a2-8d2dd716936b	240000.0	80067.0

```

Now I want to plot, actually I would like to graph the checkin\_time as X and both the licensed\_endpoints and total\_endpoints as Y on a bar chart or something. However, I cannot even get one of them to work using Figure.

When I setup the trace:

```auto
trace1 = go.Figure(
    x=df['checkin_time'],
    y=df['licensed_endpoints']
)

```

I always get a type error:

```auto
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-17-233aeadd3e03> in <module>
      1 trace1 = go.Figure(
      2 x=df['checkin_time'],
----> 3 y=df['licensed_endpoints']
.
.
.

~/.pyenv/versions/3.7.5/lib/python3.7/site-packages/plotly/basedatatypes.py in __init__ (self, data, layout_plotly, frames, skip_invalid, **kwargs)
    276 self[k] = v
    277 elif not skip_invalid:
--> 278 raise TypeError("invalid Figure property: {}".format(k))
    279 
    280 # Magic Methods

TypeError: invalid Figure property: x

```

Any ideas where I am going wrong?

Many thanks

---

<div class="post-metadata">

**Author:** ![Alexboiboi](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/alexboiboi/32/6420_2.png) [@Alexboiboi](https://community.plotly.com/u/Alexboiboi)\
**Post date:** [March 3, 2020, 1:58pm UTC](https://community.plotly.com/t/plotting-returns-data-type-issues/35730/2 "2020-03-03T13:58:55Z")

</div>

Hi @spollock,

the `go.Figure` class only accepts a list of traces such as `go.Scatter(), go.Line()` etc… You code should look like.

```python
trace1 = go.Scatter(
    x=df['checkin_time'],
    y=df['licensed_endpoints']
)

fig = go.Figure(data=[trace1])
fig.show()

```

Maybe as a new user of plotly you should spend a little time reading the documentation to understand how the library works 😉 This will make things much easier.

This would be a good start:

> **[Creating and Updating Figures](https://plot.ly/python/creating-and-updating-figures/)**
>
> Creating and Updating Figures from Python

---

<div class="post-metadata">

**Author:** ![spollock](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/spollock/32/9656_2.png) [@spollock](https://community.plotly.com/u/spollock)\
**Post date:** [March 3, 2020, 2:09pm UTC](https://community.plotly.com/t/plotting-returns-data-type-issues/35730/3 "2020-03-03T14:09:47Z")

</div>

Thats exactly my code, you might spend a little time looking at the post. Make things much easier.

---

<div class="post-metadata">

**Author:** ![Alexboiboi](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/alexboiboi/32/6420_2.png) [@Alexboiboi](https://community.plotly.com/u/Alexboiboi)\
**Post date:** [March 3, 2020, 2:23pm UTC](https://community.plotly.com/t/plotting-returns-data-type-issues/35730/4 "2020-03-03T14:23:15Z")

</div>

No, it is not the same code!!

you are trying to pass the `x` parameter to `go.Figure()` instead of passing it to `go.Scatter()`
