예제 #1
0
 def testSingleValDictDataFrameCorrReturnSerie(self):
     stockData = {"Blackstone": [49.56]
     }
     npsy = NumpySciPy()
     df = npsy.initDataFrame(stockData)
     actual = npsy.countDF(df)
     expected = pd.DataFrame(stockData).corr()
예제 #2
0
 def testDictDataFrameCorrReturnSerie(self):
     stockData = {"Blackstone": [49.56, 50.70, 51.18, 52.80, 52.87]
     }
     npsy = NumpySciPy()
     df = npsy.initDataFrame(stockData)
     actual = npsy.countDF(df)
     expected = pd.DataFrame(stockData).corr()
예제 #3
0
 def testEmptyTailDFReturnsTailDataFame(self):
     stocksData ={
     }
     npsy = NumpySciPy()
     df = npsy.initDataFrame(stocksData)
     actual = npsy.tailDF(df)
     expected = pd.DataFrame(stocksData).tail()
예제 #4
0
 def testEmptyDataFrameCorrReturnEmptySeries(self):
     stockData = {
     }
     npsy = NumpySciPy()
     df = npsy.initDataFrame(stockData)
     actual = npsy.countDF(df)
     expected = pd.DataFrame(stockData).corr()
예제 #5
0
 def testappendDFReturnsEmptyDataFame(self):
     stocksData = {
     }
     npsy = NumpySciPy()
     df = npsy.initDataFrame(stocksData)
     actual = npsy.appendDF(dataframe=df,appendDataFrame=df)
     expected = pd.DataFrame(df).append(df)
예제 #6
0
 def testEmptyHeadDFReturnsHeadDataFame(self):
     stocksData ={
     }
     npsy = NumpySciPy()
     df = npsy.initDataFrame(stocksData)
     actual = npsy.headDF(df)
     expected = pd.DataFrame(stocksData).head()
예제 #7
0
 def testaverageDFReturnsEmptySeriesMean(self):
     stockData ={
     }
     npsy = NumpySciPy()
     df = npsy.initDataFrame(stockData)
     actual = npsy.averageDF(df)
     expected = pd.DataFrame(stockData).mean()
예제 #8
0
 def testaverageDFReturnsSeriesMean(self):
     stockData ={
         "Blackstone": [49.56, 50.70, 51.18, 52.80, 52.87, 24.24, 24.60, 49.56, 26.90, 26.66]
     }
     npsy = NumpySciPy()
     df = npsy.initDataFrame(stockData)
     actual = npsy.averageDF(df)
     expected = pd.DataFrame(stockData).mean()
예제 #9
0
 def testdropDuplicateDFReturnsEmptyDataFame(self):
     stocksData = {
     }
     npsy = NumpySciPy()
     df = npsy.initDataFrame(stocksData)
     df = npsy.appendDF(dataframe=df,appendDataFrame=df)
     actual = npsy.dropDuplicatesDF(df)
     expected = pd.DataFrame(stocksData).append(df).drop_duplicates()
예제 #10
0
 def testDualArrayDictDataFrameCorrReturnSeries(self):
     stockData = {"Blackstone": [49.56, 50.70, 51.18, 52.80, 52.87],
                  "KKR": [24.24, 24.60, 26.04, 26.90, 26.66]
                  }
     npsy = NumpySciPy()
     df = npsy.initDataFrame(stockData)
     actual = npsy.countDF(df)
     expected = pd.DataFrame(stockData).corr()
예제 #11
0
 def testInitDataFrameReturnsDataFameWithDates(self):
     stocksData ={
         "Blackstone":[49.56,50.70,51.18,52.80,52.87],
         "KKR": [24.24,24.60,26.04,26.90,26.66]
     }
     dates = ['5/4/20','5/5/20','5/6/20','5/8/20','5/9/20']
     npsy = NumpySciPy()
     actual = npsy.initDataFrame(stocksData,rows=dates)
     expected = pd.DataFrame(stocksData,index=dates)
예제 #12
0
 def testdropDuplicateReturnsDataFame(self):
     stockData = {
         "Blackstone": [49.56, 50.70, 51.18, 52.80, 52.87, 24.24, 24.60, 49.56, 26.90, 26.66]
     }
     npsy = NumpySciPy()
     df = npsy.initDataFrame(stockData)
     df = npsy.appendDF(dataframe=df,appendDataFrame=df)
     actual = npsy.dropDuplicatesDF(df)
     expected = pd.DataFrame(stockData).append(df).drop_duplicates()
예제 #13
0
 def testappendDFReturnsDataFame(self):
     stocksData = {
         "Blackstone": [49.56, 50.70, 51.18, 52.80, 52.87, 24.24, 24.60, 26.04, 26.90, 26.66],
         "KKR": [24.24, 24.60, 26.04, 26.90, 26.66, 24.24, 24.60, 26.04, 26.90, 26.66]
     }
     npsy = NumpySciPy()
     df = npsy.initDataFrame(stocksData)
     actual = npsy.appendDF(dataframe=df,appendDataFrame=df)
     expected = pd.DataFrame(stocksData).append(df)
예제 #14
0
 def testNotFilterColumnDFForCompanyBlackstone(self):
     stockData = {
         'Company': ["BlackStone","KKR","Chase","Bank Of America","Wells Fargo","Morgan Stanley"],
         "Closing Price":[56.26,21.60,100.21,26.75,84.61,246.25],
         "LocationHQ": ["New York City,NY","New York City,NY","New York City,NY","Charlotte, NC", "San Francisco, CA","New York City,NY"]
     }
     npsy = NumpySciPy()
     df = npsy.initDataFrame(stockData)
     actual = npsy.notFilterColumnDF(df,"Company","BlackStone")
예제 #15
0
 def testDefaul10TailDFReturnsTailDataFame(self):
     stocksData = {
         "Blackstone": [49.56, 50.70, 51.18, 52.80, 52.87,24.24, 24.60, 26.04, 26.90, 26.66],
         "KKR": [24.24, 24.60, 26.04, 26.90, 26.66,24.24, 24.60, 26.04, 26.90, 26.66]
     }
     dates = ['5/4/20', '5/5/20', '5/6/20', '5/8/20', '5/9/20','5/4/20', '5/5/20', '5/6/20', '5/8/20', '5/9/20']
     npsy = NumpySciPy()
     df = npsy.initDataFrame(stocksData, rows=dates)
     actual = npsy.tailDF(df,)
     expected = pd.DataFrame(stocksData, index=dates).tail(10)
예제 #16
0
 def testInitDataFrameReturnsDataFame(self):
     stocksData ={
         "Blackstone":[49.56,50.70,51.18,52.80,52.87],
         "KKR": [24.24,24.60,26.04,26.90,26.66]
     }
     npsy = NumpySciPy()
     actual = npsy.initDataFrame(stocksData)
     print(actual)
     expected = pd.DataFrame(stocksData)
     print(expected)
예제 #17
0
 def testFilterColumnDFAdvForCompanyEmptyDF(self):
     stockData = {
     }
     npsy = NumpySciPy()
     df = npsy.initDataFrame(stockData)
     try:
         actual = npsy.filterColumnDFAdv(df, "Company", "BlackStone")
         print(actual)
     except(KeyError):
         print("Key Doesn't Exist")
예제 #18
0
 def testFilterColumnDFAdvForNotEqualsClosingPrice(self):
     stockData = {
         'Company': ["BlackStone", "KKR", "Chase", "Bank Of America", "Wells Fargo", "Morgan Stanley"],
         "Closing Price": [56.26, 21.60, 100.21, 26.75, 84.61, 246.25],
         "LocationHQ": ["New York City,NY", "New York City,NY", "New York City,NY", "Charlotte, NC",
                        "San Francisco, CA", "New York City,NY"]
     }
     npsy = NumpySciPy()
     df = npsy.initDataFrame(stockData)
     actual = npsy.filterColumnDFAdv(df, "Closing Price", 100.21,filterType="NOT_EQUALS")
     print(actual)
예제 #19
0
 def testNotFilterColumnDFForOpenPricePrice1226(self):
     stockData = {
         'Company': ["BlackStone", "KKR", "Chase", "Bank Of America", "Wells Fargo", "Morgan Stanley"],
         "Closing Price": [56.26, 21.60, 100.21, 56.26, 84.61, 246.25],
         "LocationHQ": ["New York City,NY", "New York City,NY", "New York City,NY", "Charlotte, NC",
                        "San Francisco, CA", "New York City,NY"]
     }
     npsy = NumpySciPy()
     df = npsy.initDataFrame(stockData)
     try:
         actual = npsy.notFilterColumnDF(df, "Opening Price", 12.26)
     except(KeyError):
         print("Key Doesn't Exist")
예제 #20
0
 def testEmptyDataInitDataFrameReturnsDataFame(self):
     stocksData ={
     }
     npsy = NumpySciPy()
     actual = npsy.initDataFrame(stocksData)
     expected = pd.DataFrame(stocksData)