Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- +-------+----------+-------+
- | Total | Quantity | Piece |
- +-------+----------+-------+
- | 8 | 2 | 4 |
- | 8 | 2 | 4 |
- | 8 | 2 | 4 |
- | 8 | 2 | 4 |
- | 8 | 2 | 4 |
- | 8 | 2 | 4 |
- | 8 | 2 | 4 |
- | 8 | 2 | 4 |
- | 8 | 2 | 4 |
- +-------+----------+-------+
- +-------+----------+-------+
- | Total | Quantity | Piece |
- +-------+----------+-------+
- | 8 | 2 | 4 |
- | 8 | 4 | 2 |
- | 8 | 2 | 4 |
- | 8 | 4 | 2 |
- | 8 | 2 | 4 |
- | 8 | 2 | 4 |
- | 8 | 4 | 2 |
- | 8 | 2 | 4 |
- | 8 | 4 | 2 |
- +-------+----------+-------+
- import pandas as pd
- data = [['Total 8rrnQuantity 2rrnPiece 4'], ['Total 8rrnQuantity 2rrnPiece 4'],['Total 8rrnPiece 2rrnQuantity 4'], ['Total 8rrnQuantity 2rrnPiece 4'], ['Total 8rrnPiece 2rrnQuantity 4'],['Total 8rrnQuantity 2rrnPiece 4'], ['Total 8rrnQuantity 2rrnPiece 4'],['Total 8rrnPiece 2rrnQuantity 4'], ['Total 8rrnQuantity 2rrnPiece 4'], ['Total 8rrnPiece 2rrnQuantity 4']]
- df = pd.DataFrame(data, columns = ['Information'])
- df["Total"] = df["Information"].str.extract(r"Total (d+)")
- df["Quantity"] = df["Information"].str.extract(r"Quantity (d+)")
- df["Piece"] = df["Information"].str.extract(r"Piece (d+)")
- df.drop("Information", inplace=True, axis=1)
- print(df)
- Total Quantity Piece
- 0 8 2 4
- 1 8 2 4
- 2 8 4 2
- 3 8 2 4
- 4 8 4 2
- 5 8 2 4
- 6 8 2 4
- 7 8 4 2
- 8 8 2 4
- 9 8 4 2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement