<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Proc Python pandas error on sas viya 4 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-Python-pandas-error-on-sas-viya-4/m-p/956090#M373355</link>
    <description>&lt;P&gt;Why Do I get the error message&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;"Pandas is not installed, so you can't use this function"&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;when running this code?&lt;/P&gt;
&lt;P&gt;I do see the correct print (df_exe) output in the log.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc python ;
   submit ;

import pandas as pd
import numpy as np

# Creating a DataFrame by passing a dictionary of objects
df_exe = pd.DataFrame({
"A": 1.0,
"B": pd.Timestamp("20130102"),
"C": pd.Series(1, index=list(range(4)), dtype="float32"),
"D": np.array([3] * 4, dtype="int32"),
"E": pd.Categorical(["test", "train", "test", "train"]),
"F": "foo"
})

print (df_exe)

# Send the data to SAS using PROC PYTHON callback method
ds = SAS.df2sd(df_exe,"userdata")

   endsubmit ;
run ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 14 Jan 2025 17:24:38 GMT</pubDate>
    <dc:creator>acordes</dc:creator>
    <dc:date>2025-01-14T17:24:38Z</dc:date>
    <item>
      <title>Proc Python pandas error on sas viya 4</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Python-pandas-error-on-sas-viya-4/m-p/956090#M373355</link>
      <description>&lt;P&gt;Why Do I get the error message&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;"Pandas is not installed, so you can't use this function"&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;when running this code?&lt;/P&gt;
&lt;P&gt;I do see the correct print (df_exe) output in the log.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc python ;
   submit ;

import pandas as pd
import numpy as np

# Creating a DataFrame by passing a dictionary of objects
df_exe = pd.DataFrame({
"A": 1.0,
"B": pd.Timestamp("20130102"),
"C": pd.Series(1, index=list(range(4)), dtype="float32"),
"D": np.array([3] * 4, dtype="int32"),
"E": pd.Categorical(["test", "train", "test", "train"]),
"F": "foo"
})

print (df_exe)

# Send the data to SAS using PROC PYTHON callback method
ds = SAS.df2sd(df_exe,"userdata")

   endsubmit ;
run ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2025 17:24:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Python-pandas-error-on-sas-viya-4/m-p/956090#M373355</guid>
      <dc:creator>acordes</dc:creator>
      <dc:date>2025-01-14T17:24:38Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Python pandas error on sas viya 4</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Python-pandas-error-on-sas-viya-4/m-p/956098#M373358</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/127222"&gt;@acordes&lt;/a&gt;! I tested your code on my Viya environment and it worked as expected:&lt;/P&gt;
&lt;PRE&gt;&amp;gt;&amp;gt;&amp;gt;
     A          B    C  D      E    F
0  1.0 2013-01-02  1.0  3   test  foo
1  1.0 2013-01-02  1.0  3  train  foo
2  1.0 2013-01-02  1.0  3   test  foo
3  1.0 2013-01-02  1.0  3  train  foo
Note that Indexes are not transferred over as columns. Only actual columns are transferred
&amp;gt;&amp;gt;&amp;gt; 
NOTE: PROCEDURE PYTHON used (Total process time):
      real time           12.25 seconds
      cpu time            0.03 seconds&lt;/PRE&gt;
&lt;P&gt;This must mean that pandas is not installed in your Viya Python environment. To add packages to your Python environment in SAS, check out this blog on using the &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Using-the-SAS-Configurator-for-Open-Source-to-Build-Python-and-R/ta-p/842310" target="_self"&gt;SAS Configurator for Open Source to Build Python and R&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2025 18:26:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Python-pandas-error-on-sas-viya-4/m-p/956098#M373358</guid>
      <dc:creator>Stu_SAS</dc:creator>
      <dc:date>2025-01-14T18:26:14Z</dc:date>
    </item>
  </channel>
</rss>

