Skip to content Skip to sidebar Skip to footer

Choosing The Correct Values In Excel In Python

General Overview: I am creating a graph of a large data set, however i have created a sample text document so that it is easier to overcome the problems. The Data is from an excel

Solution 1:

Not sure why you are creating the transposed CSV version. It is also possible to work directly from your original data. For example:

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

df = pd.read_csv('CSV_GM_NB_Test.csv', skiprows=8)

data = df.ix[:,19:].T
data.columns = df['SN']
data.plot()
plt.show()

This would give you:

plot screenshot

You can use pandas.DataFrame.ix() to give you a sliced version of your data using integer positions. The [:,19:] says to give you columns 19 onwards. The final .T transposes it. You can then apply the values for the SN column as column headings using .columns to specify the names.

Post a Comment for "Choosing The Correct Values In Excel In Python"