Python Forum
Dataframe with array value
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dataframe with array value
#1
Hello All,

I want to make a new dataframe for every unique value from a column.
For one specific column I can write it manually, but my script needs to be compatible with other columns as well.
So it should automatically detect the specific values of a column and than make new dataframes with the specific values.
I am still new to programming, but I cannot seem to find an answer to this problem, maybe someone on this forum knows how to do this
print(df['ent_name'].unique())

['DNS_8-WM2' 'DNS_8' 'DNS_8-WM1' 'DNS_8-WM5' 'DNS_8-LP1' 'DNS_8-LP2'
 'DNS_8-LP5' 'DNS_8-LP6' 'DNS_8-ATM1']

#making new dataframes manually
DNS_8 = df[df.ent_name == 'DNS_8']
DNS_8_WM1 = df[df.ent_name == 'DNS_8-WM1']
DNS_8_WM2 = df[df.ent_name == 'DNS_8-WM2']
DNS_8_WM5 = df[df.ent_name == 'DNS_8-WM5']

# Split data from Main tool and modules
Larz60+ write Mar-23-2021, 10:06 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.

Fixed for you this time. Please use bbcode on future posts.
Reply


Messages In This Thread
Dataframe with array value - by Tibovdv - Mar-23-2021, 06:44 PM
RE: Dataframe with array value - by jefsummers - Mar-24-2021, 05:05 PM
RE: Dataframe with array value - by Tibovdv - Mar-24-2021, 07:22 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  converting dataframe to int numpy array glennford49 1 2,385 Apr-04-2020, 06:15 AM
Last Post: snippsat
  How to transform array into dataframe or table? python_newbie09 2 15,005 Mar-29-2019, 07:48 PM
Last Post: python_newbie09
  access a very large file? As an array or as a dataframe? Angelika 5 5,058 May-18-2017, 08:15 AM
Last Post: Angelika

Forum Jump:

User Panel Messages

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