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()
 def testSingleValDictDataFrameCorrReturnSerie(self):
     stockData = {"Blackstone": [49.56]
     }
     npsy = NumpySciPy()
     df = npsy.initDataFrame(stockData)
     actual = npsy.countDF(df)
     expected = pd.DataFrame(stockData).corr()
 def testaverageDFReturnsEmptySeriesMean(self):
     stockData ={
     }
     npsy = NumpySciPy()
     df = npsy.initDataFrame(stockData)
     actual = npsy.averageDF(df)
     expected = pd.DataFrame(stockData).mean()
 def testappendDFReturnsEmptyDataFame(self):
     stocksData = {
     }
     npsy = NumpySciPy()
     df = npsy.initDataFrame(stocksData)
     actual = npsy.appendDF(dataframe=df,appendDataFrame=df)
     expected = pd.DataFrame(df).append(df)
 def testEmptyTailDFReturnsTailDataFame(self):
     stocksData ={
     }
     npsy = NumpySciPy()
     df = npsy.initDataFrame(stocksData)
     actual = npsy.tailDF(df)
     expected = pd.DataFrame(stocksData).tail()
 def testEmptyHeadDFReturnsHeadDataFame(self):
     stocksData ={
     }
     npsy = NumpySciPy()
     df = npsy.initDataFrame(stocksData)
     actual = npsy.headDF(df)
     expected = pd.DataFrame(stocksData).head()
 def testEmptyDataFrameCorrReturnEmptySeries(self):
     stockData = {
     }
     npsy = NumpySciPy()
     df = npsy.initDataFrame(stockData)
     actual = npsy.countDF(df)
     expected = pd.DataFrame(stockData).corr()
 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()
 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()
Esempio n. 10
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()
Esempio n. 11
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")
Esempio n. 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()
Esempio n. 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)
Esempio n. 14
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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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")
Esempio n. 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)
Esempio n. 19
0
 def test_emptyArrayNumpyArray_returns_array(self):
     npsp = NumpySciPy()
     arrays = []
     actual = npsp.numpyArray(arrays)
     expected = np.array(arrays)
     boolArray= actual == expected
     isTrue =None
     if False in boolArray:
         isTrue = False
     else:
         isTrue = True
     self.assertTrue(isTrue)
Esempio n. 20
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")
Esempio n. 21
0
 def testNumpyAverageMixTypesValueArray(self):
     npsy = NumpySciPy()
     multiArray = [[0.01,1],[0.01,1]]
     actual = npsy.numpyAverage(multiArray)
     expected = 0.505
     self.assertEqual(expected,actual)
Esempio n. 22
0
 def testNumpyAverageOneValueArray(self):
     npsy = NumpySciPy()
     multiArray = [[1,2],[1,2]]
     actual = npsy.numpyAverage(multiArray)
     expected = 1.5
     self.assertEqual(expected,actual)
Esempio n. 23
0
 def testNumpyAveragetwoValueArray(self):
     npsy = NumpySciPy()
     emptyArray = [[1,2]]
     actual = npsy.numpyAverage(emptyArray)
     expected = 1.5
     self.assertEqual(expected,actual)
Esempio n. 24
0
 def testNumpyAverageEmptyArray(self):
     npsy = NumpySciPy()
     emptyArray = []
     isNaN = np.isnan(npsy.numpyAverage(emptyArray))
     self.assertTrue(isNaN)
Esempio n. 25
0
 def testNumpySizeArray3_returns_size1(self):
     npsy = NumpySciPy()
     emptyArray = [[1],[2],[3]]
     actual = npsy.numpySize(emptyArray)
     expected = 3
     self.assertEqual(expected, actual)
Esempio n. 26
0
 def testNumpySizeEmptyArray_returns_size0(self):
     npsy = NumpySciPy()
     emptyArray = []
     actual = npsy.numpySize(emptyArray)
     expected = 0
     self.assertEqual(expected,actual)
Esempio n. 27
0
 def testArrayInitSeriesreturnSeries(self):
     priceArray = [49.56, 50.70, 51.18, 52.80, 52.87]
     npsy = NumpySciPy()
     actual = npsy.initSeries(priceArray)
     expected = pd.Index(priceArray)
Esempio n. 28
0
 def test2DArrayInitSeriesreturnObjectSeries(self):
     priceArray = [[49.56, 50.70, 51.18, 52.80, 52.87],[24.24, 24.60, 26.04, 26.90, 26.66]]
     npsy = NumpySciPy()
     actual = npsy.initSeries(priceArray)
     expected = pd.Index(priceArray)
Esempio n. 29
0
 def testSingleValueArrayValueCountSeriesreturnSerie(self):
     priceArray = [52.80]
     npsy = NumpySciPy()
     series = npsy.initSeries(priceArray)
     actual = npsy.valueCountSeries(series)
     expected = pd.Index(priceArray).value_counts()
Esempio n. 30
0
 def testArrayvalueCountSeriesreturnEmptySeries(self):
     priceArray = [52.80, 52.80, 51.18, 52.80,51.18,52.87]
     npsy = NumpySciPy()
     series = npsy.initSeries(priceArray)
     actual = npsy.valueCountSeries(series)
     expected = pd.Index(priceArray).value_counts()