0

Suppose I have the following data

                StadiumType                   Turf  Temperature  Humidity      GameId
0                   Outdoor             Field Turf         63.0      77.0  2017090700
1                  Outdoors           A-Turf Titan         65.0      53.0  2017091000
2             Green Outdoor                  Grass         64.0      57.0  2017091001
3               Red Outdoor  UBU Sports Speed S5-M         68.0      43.0  2017091002
4                   Outdoor                  Grass         63.0      53.0  2017091003

I found that using pd.read_clipboard() doesn't work well because the white space. I ended up with awkward split and join using with context manager. Is there any easier way than this?

Thanks very much.

  • 3
    [`pd.read_clipboard("\s\s+")`](https://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples#comment94739875_20159305) works for this data. – Mustafa Aydın Jul 01 '21 at 18:16
  • 1
    Oh gosh, works like charm! Thanks a million! – Hogwash MRA Jul 01 '21 at 18:29
  • 1
    @MustafaAydın What!? This is like magic. I've needed this for years! (Though wouldn't your code be much more readable with single quotes?) :-) – jch Jul 01 '21 at 20:42
  • @jch Glad it's useful! (but I kindly disagree with the last part of your comment :p) – Mustafa Aydın Jul 01 '21 at 20:46

0 Answers0