Linked Questions

114 votes
2 answers
227k views

I have the following dataframe: Year Country medal no of medals 1896 Afghanistan Gold 5 1896 Afghanistan Silver 4 1896 Afghanistan Bronze 3 ...
richie's user avatar
  • 18.7k
103 votes
2 answers
100k views

I've seen a few variations on the theme of exploding a column/series into multiple columns of a Pandas dataframe, but I've been trying to do something and not really succeeding with the existing ...
Idan Gazit's user avatar
  • 2,600
31 votes
2 answers
66k views

I have a dataframe (df) that looks like this: +---------+-------+------------+----------+ | subject | pills | date | strength | +---------+-------+------------+----------+ | 1 | 4 | 10/...
alma123's user avatar
  • 453
31 votes
4 answers
50k views

I'm having difficulty using transpose with pandas. I have the following df: date name quantity 1/1/2018 A 5 1/1/2018 B 6 1/1/2018 C 7 1/2/2018 A 9 ...
JesusMonroe's user avatar
  • 1,641
10 votes
2 answers
50k views

So my dataset has some information by business n dates as below: Business Date Value a 1/1/2017 127 a 2/1/2017 89 b 2/1/2017 122 a 1/1/2018 555 a ...
user avatar
15 votes
1 answer
22k views

Given this dataframe: feature score searchTerm 0 a 0.534509 pizza 1 b 0.586020 pizza 2 c 0.588972 pizza 3 a 0.566261 chinese 4 b 0.572405 chinese 5 c 0....
samol's user avatar
  • 21.1k
5 votes
1 answer
12k views

I'm attempting to create cross-table / pivot table in pandas: import pandas as pd import numpy as np df = pd.DataFrame({'foo': ['one', 'one', 'one', 'two', 'two','two'],'bar': ['A', 'A', 'C', 'B', '...
Jake Bourne's user avatar
5 votes
2 answers
5k views

I have such dataframe: import pandas as pd data = [ [1, 'A', 10], [1, 'B', 20], [1, 'C', 30], [2, 'A', 30], [2, 'B', 20], [2, 'C', 10], [3, 'A', 20], [3, 'B', 40], [3, 'C', 20]...
Joe Rakhimov's user avatar
  • 5,143
5 votes
1 answer
21k views

I'm trying to reshape my long data to a wide format. The data currently looks like: OBS . date . TICKER . RET 1 . 20050131 . AAPL . 0.02 2 . 20050231 . AAPL . 0.01 3 . 20050131 . GOOG . 0.05 4 . ...
SK23's user avatar
  • 105
6 votes
3 answers
9k views

I'm having a little trouble with pivoting in pandas. The dataframe (dates, location, data) I'm working on looks like: dates location data date1 A X date2 A Y date3 ...
tomas's user avatar
  • 693
6 votes
2 answers
6k views

I am trying to reshape a pandas dataframe, by turning one of the columns in the data, into rows (by pivoting or unstacking). I am new to this, so likely that I'm missing something obvious. I've ...
brendxn's user avatar
  • 73
5 votes
4 answers
2k views

I have a pandas dataframe which contains data as shown below: ID year_month_id Class 1 201612 A 2 201612 D 3 201612 B 4 201612 Other 5 201612 ...
Shuvayan Das's user avatar
  • 1,048
5 votes
3 answers
3k views

I have a pandas data frame like this: timestamp status 2019-01-01 09:00:00 FAILED 2019-01-01 09:00:00 FAILED 2019-01-01 09:00:00 UNKNOWN 2019-01-01 09:00:00 PASSED 2019-01-01 09:00:00 ...
charemma's user avatar
5 votes
2 answers
3k views

I have a dataframe which is a list of organisations (multiple rows per organisation) which has a boolean value associated with it. So organisation A has 3 true rows and 3 false i.e. Organisation ...
Nicholas's user avatar
  • 3,777
1 vote
2 answers
7k views

I am fetching data from a source into a pandas data frame, it is like below date currency price d1 INR 31 d2 INR 32 d2 USD 21 d3 USD 41 d3 INR 51 d3 JPY 61 I want to convert it to below date INR JPY ...
Elric's user avatar
  • 84

15 30 50 per page
1
2 3 4 5
76