jaypeeee10
jaypeeee10

Reputation: 21

How to get specific data from excel

Binnings

Any idea on how can I acccess or get the box data (see image) under TI_Binning tab of excel file using python? What module or similar code you can recommend to me? I just need those specifica data and append it on other file such as .txt file.

Upvotes: 0

Views: 26

Answers (1)

Brian
Brian

Reputation: 96

Getting the data you circled:

import pandas as pd
df = pd.read_excel('yourfilepath', 'TI_Binning', skiprows=2)
df = df[['Number', 'Name']]

To appending to an existing text file:

import numpy as np
with open("filetoappenddata.txt", "ab") as f:
    np.savetxt(f, df.values)

More info here on np.savetxt for formats to fit your output need.

Upvotes: 1

Related Questions