#๐Ÿ”’ Pandas set index

12 messages ยท Page 1 of 1 (latest)

quick iris
#

Hi all, i'm trying to test out a new data source and I'm trying to make 'ts_event' column as my index. This is what I'm getting. Can anyone help?

wicked fulcrumBOT
#

@quick iris

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

quick iris
#

this is the code btw

kindred jacinth
#

i think that's literally a dict in the dataframe?

wary siren
kindred jacinth
#

!d pandas.json_normalize

wicked fulcrumBOT
#

pandas.json_normalize(data, record_path=None, meta=None, meta_prefix=None, record_prefix=None, errors='raise', sep='.', max_level=None)```
Normalize semi-structured JSON data into a flat table.
kindred jacinth
# wicked fulcrum

you need to normalise it flat table first if you want it to be the index, using this โ˜๏ธ

quick iris
#

would I need to normalise all data? or just ts_events?

kindred jacinth
#

you need to normalise the column that contains the dict, not ts_events, the whole point is that ts_events is not yet a column but a key inside a dict in some unknown column which you haven't shown us, hope that makes sense

wicked fulcrumBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.