How to find Pearson Correlation Coefficient in python for user to user similarity?2019 Community Moderator ElectionHow is NaN handled in Pearson correlation user-user similarity matrix in a recommender system?How can I represent an 'Enum' in Python?How do I use raw_input in Python 3Understanding the Pearson Correlation Coefficient map reduce - pearson correlationEmploying correlation coefficients (Pearson) for dimension reduction [Python]Pearson correlation fails for perfectly correlated setsPearson correlation coefficientPearson Correlation Coefficient different for different currencies?How to Offset Pandas Pearson Correlation with Datetime Indexpearsons linear coefficient keras

What are some noteworthy "mic-drop" moments in math?

Vocabulary for giving just numbers, not a full answer

Was it really inappropriate to write a pull request for the company I interviewed with?

After `ssh` without `-X` to a machine, is it possible to change `$DISPLAY` to make it work like `ssh -X`?

Why do phishing e-mails use faked e-mail addresses instead of the real one?

I can't die. Who am I?

Has a sovereign Communist government ever run, and conceded loss, on a fair election?

What can I do if someone tampers with my SSH public key?

Do I really need to have a scientific explanation for my premise?

Doubts in understanding some concepts of potential energy

What is better: yes / no radio, or simple checkbox?

Why aren't there more Gauls like Obelix?

Is it a Cyclops number? "Nobody" knows!

Trig Subsitution When There's No Square Root

For which categories of spectra is there an explicit description of the fibrant objects via lifting properties?

Which situations would cause a company to ground or recall a aircraft series?

Which classes are needed to have access to every spell in the PHB?

What is this diamond of every day?

Is divide-by-zero a security vulnerability?

How to write a chaotic neutral protagonist and prevent my readers from thinking they are evil?

Can't make sense of a paragraph from Lovecraft

Finitely many repeated replacements

Plausibility of Mushroom Buildings

What do you call someone who likes to pick fights?



How to find Pearson Correlation Coefficient in python for user to user similarity?



2019 Community Moderator ElectionHow is NaN handled in Pearson correlation user-user similarity matrix in a recommender system?How can I represent an 'Enum' in Python?How do I use raw_input in Python 3Understanding the Pearson Correlation Coefficient map reduce - pearson correlationEmploying correlation coefficients (Pearson) for dimension reduction [Python]Pearson correlation fails for perfectly correlated setsPearson correlation coefficientPearson Correlation Coefficient different for different currencies?How to Offset Pandas Pearson Correlation with Datetime Indexpearsons linear coefficient keras










2















I have CSV file which ('user_id')which is 100 and ('Product_id') which is 16370 Columns wise.How i calculate the user to user similarity using Pearson Correlation Coefficient.For that i Using the build in function of python Pearsons, but it show me error.



+-----------------+-------------+-------------+-----------+
| user_id | B004MYH08U | B000BNXDBO | 783229135 |
+-----------------+-------------+-------------+-----------+
| A11L5M4MJP00UW | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A13NO1WIGJZUV4 | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A141HP4LYPWMSR | 1 | 4 | 4 |
+-----------------+-------------+-------------+-----------+
| A14HV65O34S8EF | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A174WE983H06N4 | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A17RUD7RKGZUA4 | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A18758S1PUYIDT | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A19O5ETNRJN39D | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A1AFHYBINSG7PH | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A1CIW2OEVAJRM2 | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A1D12NAC1U12F0 | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A1DDVFGUC6NQD3 | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A1DZ4MTJY8LAVG | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A1FRPGQYQTAOR1 | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A1I7QGUDP043DG | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A1J50B4K22D93F | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A1M3W0ROKC7F3C | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A1M5405JH9THP9 | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A1MIFONBFK8OWE | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A1MXSUEA3ZK5UZ | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A1NN07FHTQZZ6K | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A1OUBOGB5970AO | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A1R6DF0KOJ0TG6 | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A1RSDE90N6RSZF | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A1VJCDRXUQVXBM | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A23Q1T4MXZHFM7 | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A245OASCPKPJHC | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A2582KMXLK2P06 | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A27H9DOUGY9FOS | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A2942G3FDOIM18 | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A295JWKTJLM7YT | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A29DLKCN8QWO7B | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A2BTR8ZO8MB01D | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A2D595HNMO9PHR | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A2DLKD4AC5JV5Q | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A2FX6OHBMQ9545 | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A2H5D7IK9SF07M | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A2I6MHMAZZDCRX | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A2IMLPUXYQJTSY | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A2IOMS4TK2QSFW | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A2IT3899H776LW | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A2M2O1DI1SCQDI | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A2M4H4R4Z7UDZX | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A2OKCS5234ZV7S | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A2ON9S58W4AZ1Z | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A2P7UB02HAVEPB | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A2R1VN4J5L2ZCO | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A2TTVV34NLMZI8 | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A2TX99AZKDK0V7 | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A2UFG3DMVELP6I | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A2URPOBDQK3WG | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A2VDM3D712BGLE | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A2WFI5XFB7NHHJ | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A2YWH9COGWT8VU | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A31YQQYX9PU04Z | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A328S9RN3U5M68 | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A34KFDQ5KBHZA5 | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A36SSF310LBGSE | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A39I79H1A2A8C3 | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A39M64IZTC04G0 | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A3ENN12GLNTUAF | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A3GX0UO7XXZST2 | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A3IG9WGCIHPJ6X | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A3N27L13CWJ9HY | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A3N2MVBI1A2I9Y | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A3NNR95R50VB4W | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A3NPHQVIY59Y0Y | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A3NWP0SFAC0ZD2 | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A3Q4S5DFVPB70D | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A3QIEISBZP4QTV | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A3QYDL5CDNYN66 | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A3R95JCH1K9R0S | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A3RVH9HUN9J4LZ | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A3VP6XR88INLRB | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A44YJ6ZLTMAR6 | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A4FBBS25X3XEL | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A63FDY7VFOMQV | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A66KMXH9V7OGU | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A7LRQFZW3D9NE | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A8DDTUL8OWFMO | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| A9Q28YTLYREO7 | 0 | 3 | 4 |
+-----------------+-------------+-------------+-----------+
| AA72A0AYTWV5Y | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| AD4CDZK7D31XP | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| AFC8IKR407HSK | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| AFJ27ZV9183B8 | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| AFKMBAY28XO8A | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| AH7ZNGM8WOOGN | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| AMEJTGF5NQLNH | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| ANZNLFBN62YKH | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| AOIT2QUH8GRGA | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| AQJVNDW6YZFQS | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| ASES4LU7WKYC | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| ATK3QFC6L1318 | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| ATXL536YX71TR | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| AUQW6UEZFC7B2 | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| AVQRC2N2SSSYS | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| AVV8PPI6BDKVA | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| AWPODHOB4GFWL | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+
| AXMKAXC0TR9AW | 0 | 0 | 0 |
+-----------------+-------------+-------------+-----------+


I Already post the code:



from scipy.stats import pearsonr
data = pd.read_csv("result2.csv")


USER = data.iloc[:,0:16370].values
arr =np.array(USER[0]).tostring()
arr2 =np.array(USER[1]).tostring()
vla = pearsonr(arr, arr2)
print(vla)



Error is :TypeError: len() of unsized object




Can anyone help me How to find Pearson Correlation Coefficient using python?
Here one guy already did this how i contact with him?enter link description here










share|improve this question


























    2















    I have CSV file which ('user_id')which is 100 and ('Product_id') which is 16370 Columns wise.How i calculate the user to user similarity using Pearson Correlation Coefficient.For that i Using the build in function of python Pearsons, but it show me error.



    +-----------------+-------------+-------------+-----------+
    | user_id | B004MYH08U | B000BNXDBO | 783229135 |
    +-----------------+-------------+-------------+-----------+
    | A11L5M4MJP00UW | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A13NO1WIGJZUV4 | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A141HP4LYPWMSR | 1 | 4 | 4 |
    +-----------------+-------------+-------------+-----------+
    | A14HV65O34S8EF | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A174WE983H06N4 | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A17RUD7RKGZUA4 | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A18758S1PUYIDT | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A19O5ETNRJN39D | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A1AFHYBINSG7PH | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A1CIW2OEVAJRM2 | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A1D12NAC1U12F0 | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A1DDVFGUC6NQD3 | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A1DZ4MTJY8LAVG | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A1FRPGQYQTAOR1 | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A1I7QGUDP043DG | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A1J50B4K22D93F | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A1M3W0ROKC7F3C | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A1M5405JH9THP9 | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A1MIFONBFK8OWE | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A1MXSUEA3ZK5UZ | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A1NN07FHTQZZ6K | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A1OUBOGB5970AO | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A1R6DF0KOJ0TG6 | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A1RSDE90N6RSZF | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A1VJCDRXUQVXBM | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A23Q1T4MXZHFM7 | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A245OASCPKPJHC | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A2582KMXLK2P06 | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A27H9DOUGY9FOS | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A2942G3FDOIM18 | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A295JWKTJLM7YT | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A29DLKCN8QWO7B | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A2BTR8ZO8MB01D | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A2D595HNMO9PHR | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A2DLKD4AC5JV5Q | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A2FX6OHBMQ9545 | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A2H5D7IK9SF07M | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A2I6MHMAZZDCRX | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A2IMLPUXYQJTSY | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A2IOMS4TK2QSFW | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A2IT3899H776LW | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A2M2O1DI1SCQDI | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A2M4H4R4Z7UDZX | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A2OKCS5234ZV7S | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A2ON9S58W4AZ1Z | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A2P7UB02HAVEPB | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A2R1VN4J5L2ZCO | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A2TTVV34NLMZI8 | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A2TX99AZKDK0V7 | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A2UFG3DMVELP6I | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A2URPOBDQK3WG | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A2VDM3D712BGLE | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A2WFI5XFB7NHHJ | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A2YWH9COGWT8VU | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A31YQQYX9PU04Z | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A328S9RN3U5M68 | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A34KFDQ5KBHZA5 | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A36SSF310LBGSE | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A39I79H1A2A8C3 | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A39M64IZTC04G0 | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A3ENN12GLNTUAF | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A3GX0UO7XXZST2 | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A3IG9WGCIHPJ6X | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A3N27L13CWJ9HY | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A3N2MVBI1A2I9Y | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A3NNR95R50VB4W | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A3NPHQVIY59Y0Y | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A3NWP0SFAC0ZD2 | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A3Q4S5DFVPB70D | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A3QIEISBZP4QTV | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A3QYDL5CDNYN66 | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A3R95JCH1K9R0S | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A3RVH9HUN9J4LZ | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A3VP6XR88INLRB | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A44YJ6ZLTMAR6 | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A4FBBS25X3XEL | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A63FDY7VFOMQV | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A66KMXH9V7OGU | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A7LRQFZW3D9NE | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A8DDTUL8OWFMO | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | A9Q28YTLYREO7 | 0 | 3 | 4 |
    +-----------------+-------------+-------------+-----------+
    | AA72A0AYTWV5Y | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | AD4CDZK7D31XP | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | AFC8IKR407HSK | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | AFJ27ZV9183B8 | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | AFKMBAY28XO8A | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | AH7ZNGM8WOOGN | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | AMEJTGF5NQLNH | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | ANZNLFBN62YKH | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | AOIT2QUH8GRGA | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | AQJVNDW6YZFQS | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | ASES4LU7WKYC | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | ATK3QFC6L1318 | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | ATXL536YX71TR | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | AUQW6UEZFC7B2 | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | AVQRC2N2SSSYS | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | AVV8PPI6BDKVA | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | AWPODHOB4GFWL | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+
    | AXMKAXC0TR9AW | 0 | 0 | 0 |
    +-----------------+-------------+-------------+-----------+


    I Already post the code:



    from scipy.stats import pearsonr
    data = pd.read_csv("result2.csv")


    USER = data.iloc[:,0:16370].values
    arr =np.array(USER[0]).tostring()
    arr2 =np.array(USER[1]).tostring()
    vla = pearsonr(arr, arr2)
    print(vla)



    Error is :TypeError: len() of unsized object




    Can anyone help me How to find Pearson Correlation Coefficient using python?
    Here one guy already did this how i contact with him?enter link description here










    share|improve this question
























      2












      2








      2








      I have CSV file which ('user_id')which is 100 and ('Product_id') which is 16370 Columns wise.How i calculate the user to user similarity using Pearson Correlation Coefficient.For that i Using the build in function of python Pearsons, but it show me error.



      +-----------------+-------------+-------------+-----------+
      | user_id | B004MYH08U | B000BNXDBO | 783229135 |
      +-----------------+-------------+-------------+-----------+
      | A11L5M4MJP00UW | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A13NO1WIGJZUV4 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A141HP4LYPWMSR | 1 | 4 | 4 |
      +-----------------+-------------+-------------+-----------+
      | A14HV65O34S8EF | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A174WE983H06N4 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A17RUD7RKGZUA4 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A18758S1PUYIDT | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A19O5ETNRJN39D | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A1AFHYBINSG7PH | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A1CIW2OEVAJRM2 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A1D12NAC1U12F0 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A1DDVFGUC6NQD3 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A1DZ4MTJY8LAVG | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A1FRPGQYQTAOR1 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A1I7QGUDP043DG | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A1J50B4K22D93F | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A1M3W0ROKC7F3C | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A1M5405JH9THP9 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A1MIFONBFK8OWE | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A1MXSUEA3ZK5UZ | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A1NN07FHTQZZ6K | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A1OUBOGB5970AO | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A1R6DF0KOJ0TG6 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A1RSDE90N6RSZF | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A1VJCDRXUQVXBM | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A23Q1T4MXZHFM7 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A245OASCPKPJHC | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A2582KMXLK2P06 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A27H9DOUGY9FOS | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A2942G3FDOIM18 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A295JWKTJLM7YT | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A29DLKCN8QWO7B | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A2BTR8ZO8MB01D | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A2D595HNMO9PHR | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A2DLKD4AC5JV5Q | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A2FX6OHBMQ9545 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A2H5D7IK9SF07M | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A2I6MHMAZZDCRX | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A2IMLPUXYQJTSY | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A2IOMS4TK2QSFW | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A2IT3899H776LW | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A2M2O1DI1SCQDI | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A2M4H4R4Z7UDZX | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A2OKCS5234ZV7S | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A2ON9S58W4AZ1Z | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A2P7UB02HAVEPB | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A2R1VN4J5L2ZCO | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A2TTVV34NLMZI8 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A2TX99AZKDK0V7 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A2UFG3DMVELP6I | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A2URPOBDQK3WG | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A2VDM3D712BGLE | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A2WFI5XFB7NHHJ | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A2YWH9COGWT8VU | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A31YQQYX9PU04Z | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A328S9RN3U5M68 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A34KFDQ5KBHZA5 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A36SSF310LBGSE | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A39I79H1A2A8C3 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A39M64IZTC04G0 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A3ENN12GLNTUAF | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A3GX0UO7XXZST2 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A3IG9WGCIHPJ6X | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A3N27L13CWJ9HY | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A3N2MVBI1A2I9Y | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A3NNR95R50VB4W | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A3NPHQVIY59Y0Y | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A3NWP0SFAC0ZD2 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A3Q4S5DFVPB70D | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A3QIEISBZP4QTV | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A3QYDL5CDNYN66 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A3R95JCH1K9R0S | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A3RVH9HUN9J4LZ | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A3VP6XR88INLRB | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A44YJ6ZLTMAR6 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A4FBBS25X3XEL | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A63FDY7VFOMQV | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A66KMXH9V7OGU | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A7LRQFZW3D9NE | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A8DDTUL8OWFMO | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A9Q28YTLYREO7 | 0 | 3 | 4 |
      +-----------------+-------------+-------------+-----------+
      | AA72A0AYTWV5Y | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | AD4CDZK7D31XP | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | AFC8IKR407HSK | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | AFJ27ZV9183B8 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | AFKMBAY28XO8A | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | AH7ZNGM8WOOGN | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | AMEJTGF5NQLNH | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | ANZNLFBN62YKH | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | AOIT2QUH8GRGA | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | AQJVNDW6YZFQS | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | ASES4LU7WKYC | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | ATK3QFC6L1318 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | ATXL536YX71TR | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | AUQW6UEZFC7B2 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | AVQRC2N2SSSYS | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | AVV8PPI6BDKVA | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | AWPODHOB4GFWL | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | AXMKAXC0TR9AW | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+


      I Already post the code:



      from scipy.stats import pearsonr
      data = pd.read_csv("result2.csv")


      USER = data.iloc[:,0:16370].values
      arr =np.array(USER[0]).tostring()
      arr2 =np.array(USER[1]).tostring()
      vla = pearsonr(arr, arr2)
      print(vla)



      Error is :TypeError: len() of unsized object




      Can anyone help me How to find Pearson Correlation Coefficient using python?
      Here one guy already did this how i contact with him?enter link description here










      share|improve this question














      I have CSV file which ('user_id')which is 100 and ('Product_id') which is 16370 Columns wise.How i calculate the user to user similarity using Pearson Correlation Coefficient.For that i Using the build in function of python Pearsons, but it show me error.



      +-----------------+-------------+-------------+-----------+
      | user_id | B004MYH08U | B000BNXDBO | 783229135 |
      +-----------------+-------------+-------------+-----------+
      | A11L5M4MJP00UW | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A13NO1WIGJZUV4 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A141HP4LYPWMSR | 1 | 4 | 4 |
      +-----------------+-------------+-------------+-----------+
      | A14HV65O34S8EF | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A174WE983H06N4 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A17RUD7RKGZUA4 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A18758S1PUYIDT | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A19O5ETNRJN39D | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A1AFHYBINSG7PH | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A1CIW2OEVAJRM2 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A1D12NAC1U12F0 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A1DDVFGUC6NQD3 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A1DZ4MTJY8LAVG | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A1FRPGQYQTAOR1 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A1I7QGUDP043DG | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A1J50B4K22D93F | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A1M3W0ROKC7F3C | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A1M5405JH9THP9 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A1MIFONBFK8OWE | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A1MXSUEA3ZK5UZ | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A1NN07FHTQZZ6K | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A1OUBOGB5970AO | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A1R6DF0KOJ0TG6 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A1RSDE90N6RSZF | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A1VJCDRXUQVXBM | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A23Q1T4MXZHFM7 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A245OASCPKPJHC | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A2582KMXLK2P06 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A27H9DOUGY9FOS | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A2942G3FDOIM18 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A295JWKTJLM7YT | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A29DLKCN8QWO7B | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A2BTR8ZO8MB01D | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A2D595HNMO9PHR | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A2DLKD4AC5JV5Q | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A2FX6OHBMQ9545 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A2H5D7IK9SF07M | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A2I6MHMAZZDCRX | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A2IMLPUXYQJTSY | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A2IOMS4TK2QSFW | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A2IT3899H776LW | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A2M2O1DI1SCQDI | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A2M4H4R4Z7UDZX | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A2OKCS5234ZV7S | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A2ON9S58W4AZ1Z | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A2P7UB02HAVEPB | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A2R1VN4J5L2ZCO | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A2TTVV34NLMZI8 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A2TX99AZKDK0V7 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A2UFG3DMVELP6I | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A2URPOBDQK3WG | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A2VDM3D712BGLE | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A2WFI5XFB7NHHJ | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A2YWH9COGWT8VU | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A31YQQYX9PU04Z | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A328S9RN3U5M68 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A34KFDQ5KBHZA5 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A36SSF310LBGSE | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A39I79H1A2A8C3 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A39M64IZTC04G0 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A3ENN12GLNTUAF | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A3GX0UO7XXZST2 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A3IG9WGCIHPJ6X | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A3N27L13CWJ9HY | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A3N2MVBI1A2I9Y | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A3NNR95R50VB4W | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A3NPHQVIY59Y0Y | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A3NWP0SFAC0ZD2 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A3Q4S5DFVPB70D | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A3QIEISBZP4QTV | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A3QYDL5CDNYN66 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A3R95JCH1K9R0S | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A3RVH9HUN9J4LZ | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A3VP6XR88INLRB | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A44YJ6ZLTMAR6 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A4FBBS25X3XEL | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A63FDY7VFOMQV | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A66KMXH9V7OGU | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A7LRQFZW3D9NE | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A8DDTUL8OWFMO | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | A9Q28YTLYREO7 | 0 | 3 | 4 |
      +-----------------+-------------+-------------+-----------+
      | AA72A0AYTWV5Y | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | AD4CDZK7D31XP | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | AFC8IKR407HSK | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | AFJ27ZV9183B8 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | AFKMBAY28XO8A | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | AH7ZNGM8WOOGN | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | AMEJTGF5NQLNH | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | ANZNLFBN62YKH | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | AOIT2QUH8GRGA | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | AQJVNDW6YZFQS | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | ASES4LU7WKYC | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | ATK3QFC6L1318 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | ATXL536YX71TR | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | AUQW6UEZFC7B2 | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | AVQRC2N2SSSYS | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | AVV8PPI6BDKVA | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | AWPODHOB4GFWL | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+
      | AXMKAXC0TR9AW | 0 | 0 | 0 |
      +-----------------+-------------+-------------+-----------+


      I Already post the code:



      from scipy.stats import pearsonr
      data = pd.read_csv("result2.csv")


      USER = data.iloc[:,0:16370].values
      arr =np.array(USER[0]).tostring()
      arr2 =np.array(USER[1]).tostring()
      vla = pearsonr(arr, arr2)
      print(vla)



      Error is :TypeError: len() of unsized object




      Can anyone help me How to find Pearson Correlation Coefficient using python?
      Here one guy already did this how i contact with him?enter link description here







      python-3.x recommendation-engine pearson-correlation






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 7 at 4:40









      collectiveworldcollectiveworld

      265




      265






















          0






          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55036215%2fhow-to-find-pearson-correlation-coefficient-in-python-for-user-to-user-similarit%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55036215%2fhow-to-find-pearson-correlation-coefficient-in-python-for-user-to-user-similarit%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Thal And Out Agency railway station See also References External links Navigation menuOfficial Web Site of Pakistan RailwaysArchivedOfficial Web Site of Pakistan Railwayseeexpanding ite

          Understanding generators in Python2019 Community Moderator ElectionGenerator function not working pythonFor loop not executing two timesGenerators - Printing generated valuesWhy can a python generator only be used once?What exactly do generators do?What does the “yield” keyword do?What does “list comprehension” mean? How does it work and how can I use it?sklearn Kfold acces single fold instead of for loopIs a generator the callable? Which is the generator?Apply Border To Range Of Cells Using OpenpyxlCalling an external command in PythonWhat are metaclasses in Python?What is the difference between @staticmethod and @classmethod?Finding the index of an item given a list containing it in PythonDifference between append vs. extend list methods in PythonHow can I safely create a nested directory in Python?Does Python have a ternary conditional operator?Understanding slice notationUnderstanding Python super() with __init__() methodsDoes Python have a string 'contains' substring method?

          How can I change the color of pagination dots of UIPageControl?How to change UIPageControl dotsIs there a way to change page indicator dots colorCustomize dot with image of UIPageControl at index 0 of UIPageControlNo visible @interface for 'NSObject<PageControlDelegate>' declares the selector 'pageControlPageDidChange:'How to change the color of pagination dots in UIPageControl with a different color per pagepagecontrol indicator custom image instead of DefaultChanging the colour of UIPageControl dots in MonoTouchpagecontrol selectable page visibility color?Alternative way to load ViewControllers on a UIPageControlHow to set only layer.border-color for UIpage control dots in swiftHow can I develop for iPhone using a Windows development machine?How to change the name of an iOS app?UITableView - change section header coloruipagecontrol indicator(dot)issueCustom UIPageControl dots color not changingchange the interspace between UIPageControl dotsHow to change Status Bar text color in iOSHow can I change image tintColor in iOS and WatchKitUIPageControl dots with larger space in between each dotsHow to change the color of pagination dots in UIPageControl with a different color per page