Skip to content

Commit 0c9ebd9

Browse files
committed
Enrich readme
1 parent 5519f10 commit 0c9ebd9

File tree

1 file changed

+41
-7
lines changed

1 file changed

+41
-7
lines changed

README.md

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,55 @@ dotnet also provides [scripts](https://docs.microsoft.com/en-us/dotnet/core/tool
2323
pip install pandasnet
2424
```
2525

26-
If you have any trouble to install `pythonnet` as dependency you can do it manually from the github sources
27-
```
28-
pip install git+https://github.com/pythonnet/pythonnet
29-
```
30-
I cannot automatize this workaround because unfortunately PyPi doesn't allow to declare dependencies this way.
31-
3226
## Features
3327

3428
To load the converter you need to import the pacakge once in your python environment.
3529
If the dotnet clr isn't started yet through the pytonnet package the import will.
3630

37-
```{python}
31+
```python
3832
import pandasnet
3933
```
4034

35+
We construct a simple C# function to test conversion
36+
37+
```csharp
38+
using System;
39+
using System.Collections.Generic;
40+
41+
namespace LibForTests
42+
{
43+
public class PandasNet
44+
{
45+
public static Dictionary<string, Array> BasicDataFrame(Dictionary<string, Array> df)
46+
=> df;
47+
}
48+
}
49+
```
50+
We build this function into a library named `LibForTests.dll`
51+
Now you can load it in your python environmanet then using it.
52+
53+
```python
54+
import clr
55+
import pandasnet # Load the converters
56+
import pandas as pd
57+
from datetime import datetime
58+
59+
# Load your dll
60+
clr.AddReference('LibForTests.dll')
61+
from LibForTests import PandasNet as pdnet
62+
63+
x = pd.DataFrame({
64+
'A': [1, 2, 3],
65+
'B': [1.23, 1.24, 1.22],
66+
'C': ['foo', 'bar', 'other'],
67+
'D': [datetime(2021, 1, 22), datetime(2021, 1, 23), datetime(2021, 1, 24)]
68+
})
69+
y = pdnet.BasicDataFrame(x)
70+
71+
print(y)
72+
```
73+
74+
4175
Below you can found an exhausitve list of supported data convertions.
4276

4377
### Python -> .Net

0 commit comments

Comments
 (0)