Python Forum
Break Up Tuple List Into A Dataframe?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Break Up Tuple List Into A Dataframe?
#1
It's my first time working with a tuple list, and I've run into a very strange issue.

1
df = pd.DataFrame(tuple_list)
Most items in the tuple list have 3 elements (url, number, sample data). Some items only have a url, in this case it breaks the dataframe and tries to assign 1 letter of the url per column.

Here's the full code:

https://pastebin.com/rGsFvv9a

When I run it, this is what the output looks like:

[Image: As616ilDR__Z8CYsGkPanw.png]
Reply


Messages In This Thread
Break Up Tuple List Into A Dataframe? - by digitalmatic7 - Apr-26-2018, 08:31 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  using > < for tuple , list,... akbarza 3 1,764 Feb-05-2024, 01:18 PM
Last Post: deanhystad
Question mypy unable to analyse types of tuple elements in a list comprehension tomciodev 1 1,642 Oct-17-2023, 09:46 AM
Last Post: tomciodev
  for loops break when I call the list I'm looping through Radical 4 1,957 Sep-18-2023, 07:52 AM
Last Post: buran
  Change font in a list or tuple apffal 4 3,757 Jun-16-2023, 02:55 AM
Last Post: schriftartenio
  function returns dataframe as list harum 2 3,081 Aug-13-2022, 08:27 PM
Last Post: rob101
  search a list or tuple for a specific type ot class Skaperen 8 3,644 Jul-22-2022, 10:29 PM
Last Post: Skaperen
  Using .append() with list vs dataframe Mark17 7 15,413 Jun-12-2022, 06:54 PM
Last Post: Mark17
  why is my list a tuple CompleteNewb 7 3,679 Mar-17-2022, 10:09 PM
Last Post: CompleteNewb
  List of dataframe values beginning with x,y or z glidecode 3 2,766 Nov-08-2021, 10:16 PM
Last Post: glidecode
  Reading data to python: turn into list or dataframe hhchenfx 2 6,823 Jun-01-2021, 10:28 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020