Skip to content

Instantly share code, notes, and snippets.

@tsengchan
Created April 1, 2019 04:07
Show Gist options
  • Save tsengchan/62d8cde32ec5bf12a597538b9ba5ed5e to your computer and use it in GitHub Desktop.
Save tsengchan/62d8cde32ec5bf12a597538b9ba5ed5e to your computer and use it in GitHub Desktop.
import pandas as pd
import numpy as np
#df2 = pd.DataFrame()
#columns = ['A','B', 'C','D','E','F','G']
df1_K = pd.read_table('jasonproblem.txt', names=('A','B', 'C','D','E','F','G'))
df1_inexact = df1_K.dropna(subset=['G']) ### keep only G that's inexact solution ie noNAN
df1_exact = df1_K.loc[df1_K['G'].isna()] #only exact solution
df1_exact_pos = df1_exact.loc[df1_exact['A'] == '+'] #positive, exact solution
df1_exact_neg = df1_exact.loc[df1_exact['A'] == '-'] #negative, exact solution
df1_inexact_pos = df1_inexact.loc[df1_inexact['A'] == '+'] #positive, inexact
df1_inexact_neg = df1_inexact.loc[df1_inexact['A'] == '-'] #negative, inexact
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment