Linked Questions

21 votes
1 answer
8k views

For a given data frame: UUT testa testb testc testd DateTime 2017-11-21 18:47:29 1.0 1.0 1.0 3.0 2017-11-21 18:47:30 1.0 2.0 1....
user97662's user avatar
  • 980
5 votes
1 answer
8k views

I want to take a column indexed 'length' and make it my second column. It currently exists as the 5th column. I have tried: colnames = big_df.columns.tolist() # make index "length" the second column ...
GAD's user avatar
  • 81
4 votes
1 answer
8k views

I have a pandas dataframe like this- d = {'class': [0, 1,1,0,1,0], 'A': [0,4,8,1,0,0],'B':[4,1,0,0,3,1],'Z':[0,9,3,1,4,7]} df = pd.DataFrame(data=d) A B Z class 0 0 4 0 0 1 4 1 ...
ubuntu_noob's user avatar
  • 2,375
1 vote
1 answer
2k views

I have a excel sheet similar to this, although with a lot more columns: Team Members Team1 (553) 95435 Team2 (443) 872 I want to split the team column into Team and a new column, named Team ID. I ...
suprimos's user avatar
0 votes
1 answer
985 views

I'm trying to generate a dataframe using Pandas like this: import pandas as pd x='x' y='y' z='z' Area='Area' #len(coords_x)==len(coords_y)==len(coords_z)==64 #len(area[:,0])==18 my_dict = dict( x= ...
yankee's user avatar
  • 173
1 vote
1 answer
376 views

I've looked around but can't find an exact solution, though it should be easily accomplished task: I have a DataFrame and I just want to move one of the columns to the front. How do I do this ...
mandosoft's user avatar
  • 183
-1 votes
2 answers
80 views

I have a pandas df like this id v1 v2 v3 v4 1 a a b b 2 x f f a How can I order it with a based on values from a set such as setorder = ('1','3','2','4') yields id v1 v3 v2 v4 1 a b a b ...
EGM8686's user avatar
  • 1,592
0 votes
0 answers
117 views

For example, I have a pandas dataframe like this : T2 T4 T3 T1 Time 1 0.1 0.7 0.6 0.2 18:00 2 0.3 0.4 0.1 0.4 16:00 3 0.2 0.3 0.2 0.9 20:00 4 0.1 0.7 0.5 0.4 19:00 5 0.1 0.4 0.8 0.9 17:...
Jim Chen's user avatar
  • 3,869
0 votes
1 answer
105 views

In dataframe example : medcine_preg_oth medcine_preg_oth1 medcine_preg_oth2 medcine_preg_oth3 0 Berplex Berplex None None 1 NaN ...
Theinzaw 's user avatar
0 votes
0 answers
82 views

I have pivot table: avg count days 10d 1d 20d 3d 5d 10d 1d 20d 3d 5d range 0.1 5.9 % 1.25 % 8.27 % 3.28 % 4.42 % 1104.0 1104.0 1104.0 ...
PeterL's user avatar
  • 515
2 votes
0 answers
77 views

I currently have a dataframe that looks like this CODE DATE VALUE 0001 2020-10-09 100 0001 2020-10-10 102 0002 2020-10-09 50 0002 2020-10-10 48 0003 2020-10-...
kli4's user avatar
  • 33
1 vote
0 answers
62 views

I have two csv file like test1.csv, test2.csv and in them some column headers aren't repeated and I need to append second unrepeated column to end of first and merge it to 'merge.csv' when my program ...
Olya's user avatar
  • 11
0 votes
1 answer
38 views

The issue I am having is that I want a ratio column after every variable, and not at the very end. say my dataframe is df = A B C total 15 30 45 90 20 30 50 100 10 20 30 60 I want ...
nrd271's user avatar
  • 1
0 votes
0 answers
36 views

R's tidyverse offers the function relocate() to move columns from in specific positions (e.g., df %>% relocate("col1", .after="col2"). Is there a way to do this in Python Pandas,...
baggiponte's user avatar
1796 votes
22 answers
4.2m views

How do I select columns a and b from df, and save them into a new dataframe df1? index a b c 1 2 3 4 2 3 4 5 Unsuccessful attempt: df1 = df['a':'b'] df1 = df.ix[:, 'a':'b']
user1234440's user avatar
  • 23.7k

15 30 50 per page
1
2 3 4 5 6