Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
table from wikipedia
#6
(Jul-01-2019, 12:16 PM)flow50 Wrote: #1 How can I change (in 'Rank'):
*index 221: 0 to the number 191?
*indexes 223, 224, 225: 0 to the number 192?
Try using df.ffill().
import pandas as pd
import numpy as np

df = pd.DataFrame({'A': [1, 2, np.nan, 4, np.nan, 6],
           'B': [200, np.nan, np.nan, 201, 202, 203]})

df

	A	B
0	1.0	200.0
1	2.0	NaN
2	NaN	NaN
3	4.0	201.0
4	NaN	202.0
5	6.0	203.0

df.ffill()

A	B
0	1.0	200.0
1	2.0	200.0
2	2.0	200.0
3	4.0	201.0
4	4.0	202.0
5	6.0	203.0
Reply


Messages In This Thread
table from wikipedia - by flow50 - Jun-27-2019, 10:31 AM
RE: table from wikipedia - by snippsat - Jun-27-2019, 12:47 PM
RE: table from wikipedia - by flow50 - Jun-28-2019, 03:02 PM
RE: table from wikipedia - by snippsat - Jun-28-2019, 05:22 PM
RE: table from wikipedia - by flow50 - Jul-01-2019, 12:16 PM
RE: table from wikipedia - by snippsat - Jul-01-2019, 07:12 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question Scraping Wikipedia Article (Name in 1 column & URL in 2nd column) ->CSV! Anyone? BrandonKastning 4 2,056 Jan-27-2022, 04:36 AM
Last Post: Larz60+
  fetching, parsing data from Wikipedia apollo 2 3,571 May-06-2021, 08:08 PM
Last Post: snippsat
  Need help scraping wikipedia table bborusz2 6 3,282 Dec-01-2020, 11:31 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

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